We are using Camel 2.8.3 with ServiceMix 4.4.1. The consumer is a webpage
using the jquery comet library. You are correct that I didn't publish all
my routes in the sample I provided, I just provided enough to show the
error.

I did some more experimenting and was able to start multiple cometd
endpoints, on different ports, when I put them in separate camel contexts.
The error only seems to happen when they are in the same context, which is
what I ultimately want.

Chris

On Tue, Mar 13, 2012 at 6:41 PM, Willem Jiang <[email protected]>wrote:

> Hi,
>
> Which version of Camel are you using ?
> Do you deploy the Cometd producer and consumer at the same time ?
> I guess you doesn't past all the routes those you have.
>
>
>
> On Wed Mar 14 07:29:28 2012, Chris Geer wrote:
>
>> I have a need to run multiple CometD endpoints where I can selectively
>> dispatch messages to each one based on data in my flow (splitting via
>> different comet subscriptions isn't sufficient). My plan was to run each
>> endpoint on it's own port so they wouldn't overlap but as soon as I try
>> and
>> create a second endpoint I get the following error (this is the root
>> error).
>>
>> Caused by: java.lang.**IllegalStateException: STARTED
>> at
>> org.eclipse.jetty.server.**handler.HandlerWrapper.**
>> setHandler(HandlerWrapper.**java:70)
>> at
>> org.eclipse.jetty.servlet.**ServletContextHandler.<init>(**
>> ServletContextHandler.java:**131)
>> at
>> org.eclipse.jetty.servlet.**ServletContextHandler.<init>(**
>> ServletContextHandler.java:99)
>> at
>> org.apache.camel.component.**cometd.CometdComponent.**
>> createServletForConnector(**CometdComponent.java:162)
>> at
>> org.apache.camel.component.**cometd.CometdComponent.**
>> connect(CometdComponent.java:**115)
>> at
>> org.apache.camel.component.**cometd.CometdEndpoint.connect(**
>> CometdEndpoint.java:67)
>> at
>> org.apache.camel.component.**cometd.CometdProducer.start(**
>> CometdProducer.java:48)
>> at org.apache.camel.util.**ServiceHelper.startService(**
>> ServiceHelper.java:56)
>> at org.apache.camel.impl.**ProducerCache.doGetProducer(**
>> ProducerCache.java:378)
>> ... 98 more
>>
>> I suspect it has to do with the fact the cometd component starts it's own
>> Jetty server and something about the Jetty servers isn't unique. Below is
>> the config I used to recreate the problem.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <blueprint 
>> xmlns="http://www.osgi.org/**xmlns/blueprint/v1.0.0<http://www.osgi.org/xmlns/blueprint/v1.0.0>
>> "
>>            
>> xmlns:jaxws="http://cxf.**apache.org/blueprint/jaxws<http://cxf.apache.org/blueprint/jaxws>"
>> xmlns:cxf="
>> http://cxf.apache.org/**blueprint/core<http://cxf.apache.org/blueprint/core>
>> "
>>            
>> xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>> "
>>            
>> xmlns:jaxrs="http://cxf.**apache.org/blueprint/jaxrs<http://cxf.apache.org/blueprint/jaxrs>
>> "
>>            xmlns:camelcxf="http://camel.**apache.org/schema/blueprint/**
>> cxf <http://camel.apache.org/schema/blueprint/cxf>"
>>            
>> xmlns:camel="http://camel.**apache.org/schema/blueprint<http://camel.apache.org/schema/blueprint>
>> "
>>            xsi:schemaLocation="
>>              
>> http://www.osgi.org/xmlns/**blueprint/v1.0.0<http://www.osgi.org/xmlns/blueprint/v1.0.0>
>> http://www.osgi.org/xmlns/**blueprint/v1.0.0/blueprint.xsd<http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd>
>>              
>> http://camel.apache.org/**schema/blueprint/cxf<http://camel.apache.org/schema/blueprint/cxf>
>> http://camel.apache.org/**schema/blueprint/cxf/camel-**cxf-2.8.3.xsd<http://camel.apache.org/schema/blueprint/cxf/camel-cxf-2.8.3.xsd>
>>              
>> http://camel.apache.org/**schema/blueprint<http://camel.apache.org/schema/blueprint>
>> http://camel.apache.org/**schema/blueprint/camel-**blueprint-2.8.3.xsd<http://camel.apache.org/schema/blueprint/camel-blueprint-2.8.3.xsd>
>>              
>> http://cxf.apache.org/**blueprint/jaxws<http://cxf.apache.org/blueprint/jaxws>
>> http://cxf.apache.org/schemas/**blueprint/jaxws.xsd<http://cxf.apache.org/schemas/blueprint/jaxws.xsd>
>>              
>> http://cxf.apache.org/**blueprint/core<http://cxf.apache.org/blueprint/core>
>> http://cxf.apache.org/schemas/**blueprint/core.xsd<http://cxf.apache.org/schemas/blueprint/core.xsd>
>>              
>> http://cxf.apache.org/**blueprint/jaxrs<http://cxf.apache.org/blueprint/jaxrs>
>> http://cxf.apache.org/schemas/**blueprint/jaxrs.xsd<http://cxf.apache.org/schemas/blueprint/jaxrs.xsd>
>> "
>>            default-activation="lazy">
>>
>>     <camel:camelContext id="cometd-test-route">
>>         <camel:route>
>>             <camel:from uri="direct:start"/>
>>             <camel:filter>
>>                 <camel:simple>${in.headers.**ClientID} ==
>> 5</camel:simple>
>>                 <camel:to uri="cometd://0.0.0.0:8082/**
>> events?baseResource= <http://0.0.0.0:8082/events?baseResource=>
>> ."/>
>>             </camel:filter>
>>         </camel:route>
>>
>>         <camel:route>
>>             <camel:from uri="direct:start"/>
>>             <camel:filter>
>>                 <camel:simple>${in.headers.**ClientID} ==
>> 4</camel:simple>
>>                 <camel:to uri="cometd://0.0.0.0:8083/**
>> events?baseResource= <http://0.0.0.0:8083/events?baseResource=>
>> ."/>
>>             </camel:filter>
>>         </camel:route>
>>     </camel:camelContext>
>> </blueprint>
>>
>>
>> If you comment out the second route it all works like a champ. Any help
>> would be appreciated.
>>
>> Thanks,
>> Chris
>>
>>
>
>
> --
> Willem
> ------------------------------**----
> FuseSource
> Web: http://www.fusesource.com
> Blog:    
> http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>        http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang Weibo: willemjiang
>

Reply via email to