You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Gabriel.DHalluin" <dh...@gmail.com> on 2011/04/27 12:22:25 UTC

SessionSupport for two jetty Endpoint in Osgi.

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.

Re: SessionSupport for two jetty Endpoint in Osgi.

Posted by Willem Jiang <wi...@gmail.com>.
On 4/28/11 10:53 AM, Gabriel D'Halluin wrote:
> 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?

Camel-Jetty component has a static map which hold the reference of the 
jetty server and connector. In this way we can let the different jetty 
consumer share the port across the camel context.

When you refresh the bundle A, the Jetty component will close the server 
as the server connector reference is 0, because the bundle A and bundle 
B share the same port.

So, when you start the bundle A, you will not get that 
IllegalStateException again, but I don't think the bundle B 
JettyConsumer is still touched to the Jetty server.

>
> Regards,
> Gabriel.


-- 
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

Re: SessionSupport for two jetty Endpoint in Osgi.

Posted by Gabriel D'Halluin <dh...@gmail.com>.
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 <wi...@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
>

Re: SessionSupport for two jetty Endpoint in Osgi.

Posted by Willem Jiang <wi...@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

Re: SessionSupport for two jetty Endpoint in Osgi.

Posted by Claus Ibsen <cl...@gmail.com>.
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
<dh...@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/