Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A52893D33 for ; Thu, 28 Apr 2011 02:53:39 +0000 (UTC) Received: (qmail 73033 invoked by uid 500); 28 Apr 2011 02:53:39 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 73005 invoked by uid 500); 28 Apr 2011 02:53:39 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 72997 invoked by uid 99); 28 Apr 2011 02:53:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Apr 2011 02:53:38 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=FREEMAIL_FROM,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dhalluin.gabriel@gmail.com designates 209.85.210.45 as permitted sender) Received: from [209.85.210.45] (HELO mail-pz0-f45.google.com) (209.85.210.45) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Apr 2011 02:53:32 +0000 Received: by pzk30 with SMTP id 30so1732468pzk.32 for ; Wed, 27 Apr 2011 19:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=VcdKkDe80jRcohD1892CprkLVlkfev8XwRvmF5ip+uE=; b=gzNNf/uZ3yOuAk02Qh1MiC13G4d7ya9e41D4nFMV7dXxrMFPpFFVrxhbqUd5PQbE3F hLfN3PiYXzuPhOBKzZaaOyf6q/hJ9i8jm9kgLxJMNGlFQrFhvQOk6KnTfp8+sEdXgXhK s+KoxIj9vb2rScgVXuZEbiX3iN9gWnemqSC2Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=WbtGlHz6Lgz9+UqP87hNs/I1IQaS4Q90rSxCMkbqjELtqRMXZmAgCnqRZVJEEOG9Ub tHWrN7D235xwz3500CybG+x1qbSwxpWVRYXfB3IIIEsCg+g1z9ou93hPokIfrmReD+6u 36RB7bQUjcMNZHdRF2jRTHogtCv2t9sbaBsME= MIME-Version: 1.0 Received: by 10.142.246.15 with SMTP id t15mr883835wfh.41.1303959190612; Wed, 27 Apr 2011 19:53:10 -0700 (PDT) Received: by 10.142.12.8 with HTTP; Wed, 27 Apr 2011 19:53:10 -0700 (PDT) In-Reply-To: <4DB8B9A1.8080307@gmail.com> References: <1303899745695-4343214.post@n5.nabble.com> <4DB8B9A1.8080307@gmail.com> Date: Thu, 28 Apr 2011 10:53:10 +0800 Message-ID: Subject: Re: SessionSupport for two jetty Endpoint in Osgi. From: "Gabriel D'Halluin" To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 : > 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 suppo= rt, > 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 d= o >> 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 sessionSuppo= rt >> in a endpoint but not in the other, as following: >> >> Bundle A: >> >> >> from("jetty:myUrl/myappA?cache=3Dtrue&httpBindingRef=3DmyHttpBinding&ses= sionSupport=3Dtrue") >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.process(pA) >> >> Bundle B: >> >> =A0from("jetty:myUrl/myappB?cache=3Dtrue&httpBindingRef=3DmyOtherHttpBin= ding") >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.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 >> =A0| >> BundleApplicationContextListener =A0 50 | 78 - >> org.springframework.osgi.extender - 1.2.1 | Application context refresh >> failed (OsgiBundleXmlApplicationContext(bundle=3DbundleA, >> config=3Dosgibundle:/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 >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelpe= r.java:1139)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCame= lContext.java:103)[82:org.apache.camel.camel-spring:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(Camel= ContextFactoryBean.java:238)[82:org.apache.camel.camel-spring:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.springframework.context.event.SimpleApplicationEventMulticaster.mult= icastEvent(SimpleApplicationEventMulticaster.java:97)[67:org.springframewor= k.context:3.0.5.RELEASE] >> =A0 =A0 =A0 =A0at >> >> org.springframework.context.support.AbstractApplicationContext.publishEv= ent(AbstractApplicationContext.java:303)[67:org.springframework.context:3.0= .5.RELEASE] >> =A0 =A0 =A0 =A0at >> >> org.springframework.context.support.AbstractApplicationContext.finishRef= resh(AbstractApplicationContext.java:911)[67:org.springframework.context:3.= 0.5.RELEASE] >> =A0 =A0 =A0 =A0at >> >> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationCo= ntext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[77:org.s= pringframework.osgi.core:1.2.1] >> =A0 =A0 =A0 =A0at >> >> org.springframework.osgi.context.support.AbstractDelegatedExecutionAppli= cationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[= 77:org.springframework.osgi.core:1.2.1] >> =A0 =A0 =A0 =A0at >> >> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustom= TCCL(PrivilegedUtils.java:85)[77:org.springframework.osgi.core:1.2.1] >> =A0 =A0 =A0 =A0at >> >> org.springframework.osgi.context.support.AbstractDelegatedExecutionAppli= cationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.= java:320)[77:org.springframework.osgi.core:1.2.1] >> =A0 =A0 =A0 =A0at >> >> org.springframework.osgi.extender.internal.dependencies.startup.Dependen= cyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiter= ApplicationContextExecutor.java:132)[78:org.springframework.osgi.extender:1= .2.1] >> =A0 =A0 =A0 =A0at 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 >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.component.jetty.JettyHttpComponent.enableSessionSupport= (JettyHttpComponent.java:303)[99:org.apache.camel.camel-jetty:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpCom= ponent.java:277)[99:org.apache.camel.camel-jetty:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:1= 49)[86:org.apache.camel.camel-http:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:5= 2)[86:org.apache.camel.camel-http:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)[74:or= g.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)[74:or= g.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)[= 74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelCont= ext.java:1613)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(= DefaultCamelContext.java:1888)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultC= amelContext.java:1841)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(Defau= ltCamelContext.java:1767)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultC= amelContext.java:1548)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelConte= xt.java:1440)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.ja= va:1336)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.ja= va:164)[82:org.apache.camel.camel-spring:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)[74:or= g.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)[74:or= g.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java= :1314)[74:org.apache.camel.camel-core:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext= .java:203)[82:org.apache.camel.camel-spring:2.7.1] >> =A0 =A0 =A0 =A0at >> >> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCame= lContext.java:101)[82:org.apache.camel.camel-spring:2.7.1] >> =A0 =A0 =A0 =A0... 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 =A0sessionSupport. >> 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: =A0 =A0http://willemjiang.blogspot.com (English) > =A0 =A0 =A0 =A0 http://jnn.javaeye.com (Chinese) > Twitter: willemjiang > > Connect at CamelOne May 24-26 > The Open Source Integration Conference > http://camelone.com >