camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriel D'Halluin" <dhalluin.gabr...@gmail.com>
Subject Re: SessionSupport for two jetty Endpoint in Osgi.
Date Thu, 28 Apr 2011 02:53:10 GMT
Thank you for your answers and explanations.

There is no particular reason why I would like to share the port.
Basically they are two parts of the same applications, and I thought
the less open port we got the better it is.
For the moment I have just added the session support on both bundle as
Claus suggested. I haven't really take a look at OSGi web container
and camel-servlet yet, and I'll definitely check it more closely.

There is still something I don't understand thought, about the fact it
works after a refresh of bundle A:

Bundle A : Session support  Bundle B : No session support

Start B
-> Server created with no session support
Start A
-> Crash, session support is not enabled in the server, it doesn't
create the endpoints, and i suppose the current server is unchanged.
refresh A or stop A start A
-> Doesn't crash, yet the current server should be still the one
created in the first place, with no session enabled, isn't it? Does
the JettyComponent shutdown the server, even if it has been created
and is still in use by another bundle?

Regards,
Gabriel.

2011/4/28 Willem Jiang <willem.jiang@gmail.com>:
> Can I know why you want to share the same port of Jetty with BundleA and
> BundleB? If you still want to do it you may consider to use the
> camel-servlet with OSGi web container and you can configure the session
> support at the container level.
>
> Current camel-jetty doesn't support to enable the session support across the
> url, because we just use one Servlet per port to listen to the request.
>
> To explain the issue that you met, if a Jetty server is started with the
> session support, it can still accept the consumer which doesn't have the
> session support. But if the jetty server is started without session support,
> you have to shutdown the server and restart it.
> That could explain why you refresh the bundle A (The JettyComponent will
> shutdown the server for you) can make the whole things work.
>
> Willem
>
> On 4/27/11 6:22 PM, Gabriel.DHalluin 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.
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com
>

Mime
View raw message