camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: SessionSupport for two jetty Endpoint in Osgi.
Date Wed, 27 Apr 2011 10:30:24 GMT
You can define a bean for the 2nd jetty

<bean id="jetty2" class="org.apache.camel ... JettyComponent"/>
And then use jetty2 in the uri

Or just enable session support on both bundles.

On Wed, Apr 27, 2011 at 12:22 PM, Gabriel.DHalluin
<dhalluin.gabriel@gmail.com> wrote:
> Hello,
> I'm new to Camel and the use of the mailing list, so just tell me if i do
> anything wrong. I use camel 2.7.1, karaf 2.2.0, spring 3.0.5, spring dm
> 1.2.1, ubuntu 10.04, jvm 1.6.
>
> I try to create jetty endpoints in two different osgi bundle, therefore in
> two different camel context. The problem is if I enable the sessionSupport
> in a endpoint but not in the other, as following:
>
> Bundle A:
>
> from("jetty:myUrl/myappA?cache=true&httpBindingRef=myHttpBinding&sessionSupport=true")
>                .process(pA)
>
> Bundle B:
>                from("jetty:myUrl/myappB?cache=true&httpBindingRef=myOtherHttpBinding")
>                .process(pB)
>
> There is no error if bundleA is started before bundleB.
> But If the bundleB is started before bundleA, i got the following error:
>
> 17:01:56,415 | ERROR | tenderThread-100 | ContextLoaderListener            |
> BundleApplicationContextListener   50 | 78 -
> org.springframework.osgi.extender - 1.2.1 | Application context refresh
> failed (OsgiBundleXmlApplicationContext(bundle=bundleA,
> config=osgibundle:/META-INF/spring/*.xml))
> org.apache.camel.RuntimeCamelException: java.lang.IllegalStateException:
> Server has already been started. Cannot enabled sessionSupport on
> http:0.0.0.0:8080
>        at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)[82:org.apache.camel.camel-spring:2.7.1]
>        at
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:238)[82:org.apache.camel.camel-spring:2.7.1]
>        at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[67:org.springframework.context:3.0.5.RELEASE]
>        at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[67:org.springframework.context:3.0.5.RELEASE]
>        at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[67:org.springframework.context:3.0.5.RELEASE]
>        at
> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[77:org.springframework.osgi.core:1.2.1]
>        at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[77:org.springframework.osgi.core:1.2.1]
>        at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[77:org.springframework.osgi.core:1.2.1]
>        at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[77:org.springframework.osgi.core:1.2.1]
>        at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[78:org.springframework.osgi.extender:1.2.1]
>        at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
> Caused by: java.lang.IllegalStateException: Server has already been started.
> Cannot enabled sessionSupport on http:0.0.0.0:8080
>        at
> org.apache.camel.component.jetty.JettyHttpComponent.enableSessionSupport(JettyHttpComponent.java:303)[99:org.apache.camel.camel-jetty:2.7.1]
>        at
> org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:277)[99:org.apache.camel.camel-jetty:2.7.1]
>        at
> org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:149)[86:org.apache.camel.camel-http:2.7.1]
>        at
> org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)[86:org.apache.camel.camel-http:2.7.1]
>        at
> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1613)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1888)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1841)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1767)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1548)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1440)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1336)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)[82:org.apache.camel.camel-spring:2.7.1]
>        at
> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1314)[74:org.apache.camel.camel-core:2.7.1]
>        at
> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)[82:org.apache.camel.camel-spring:2.7.1]
>        at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)[82:org.apache.camel.camel-spring:2.7.1]
>        ... 10 more
>
>
> So I just can't enable sessionSupport on an already started server, but If I
> then refresh bundleA without refreshing bundleB, it just works perfectly,
> which I find strange.I would assume it crashes again, considering the
> running server is still without  sessionSupport.
> So i wonder if this is an expected behavior and if you could give me any
> advice to avoid this.
> Again, I'm new to camel and osgi so it is likely to be a simple answer.
>
> Thank you,
> Gabriel.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/SessionSupport-for-two-jetty-Endpoint-in-Osgi-tp4343214p4343214.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message