title: More than one channel in BlazeDS
body: <p>I am trying to set up a scenario where a Flex application would be able to use resources written in two different web application implementing BlazeDS.</p>
  
  <p>I originally tried to do it by <a href="https://stackoverflow.com/questions/9726410/is-it-possible-to-connect-a-flex-application-to-two-different-blazeds-servers">specifying a channel set in my mxml code</a> and then setting this as the channel set of the service in mxml.  However, although this worked, I was getting duplicate session errors.</p>
  
  <p>It was suggested in <a href="https://stackoverflow.com/a/9726652/487812">one of the answers to my question linked to above</a> that I could/should see about setting up channels with different endpoints.  I guess this means that the Flex app will only be connecting to one service as it sees it but that the service will actually be delivering this service from another location as well.</p>
  
  <p>I tried doing the following in my services-config.xml:</p>
  
  <pre><code>        &lt;channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"&gt;
              &lt;endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/&gt;
          &lt;/channel-definition&gt;
  
          &lt;channel-definition id="my-amf2" class="mx.messaging.channels.AMFChannel"&gt;
              &lt;endpoint url="http://localhost:7001/dataservice1/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/&gt;
          &lt;/channel-definition&gt;
  </code></pre>
  
  <p>But I get the following errors in my weblogic console when trying to start up my server.</p>
  
  <blockquote>
    <p>Could not register endpoint 'my-amf' because its URL,
    '/messagebroker/amf', is already used by endpoint 'my-amf2'</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>"MessageBrokerServlet" failed to preload on startup in Web
    application: "/dataservice2".
    flex.messaging.config.ConfigurationException: Could not register
    endpoint 'my-amf' because its URL, '/messagebroker/amf', is already
    used by endpoint 'my-amf2'</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>Unable to set the activation state to true for the application
    '_appsdir_DataService2_dir'. weblogic.application.ModuleException:
    [HTTP:101216]Servlet: "MessageBrokerServlet" failed to preload on
    startup in Web application: "/dataservice2".</p>
  </blockquote>
  
  <p>I'm guessing that this is because you can only have one channel of class mx.messaging.channels.AMFChannel.  Is this correct?</p>
  
  <p>In general, is there a way around any of the problems I'm experiencing?  I'm open to different solutions.</p>
  
  <p>I've googled and read for hours and hours but can't find anything about this.</p>
  
  <p>We want to have a common functionality service that is shared amongst all applications and an application specific service that provides services specific to that application.</p>