Hi John, you are right it's a question of OR and it's not a bug it's by design.
Btw. the WhiteBoard extender is a extension of the standard HttpService and it's also able to deploy JSPs with which itself is not part of the OSGi spec. That's why the OSGi spec was enhanced for the War Extension Mechanism and by the way Pax-Web is the reference implementation of it :-) though these credits don't go to me but to other people like Alin. 2011/5/6 John Hawksley <john.hawks...@gmail.com>: > Hi Achim, > > Many thanks for the fast reply. As far as feedback goes: fantastic work. > The WAR extender alone is superb and makes life very simple indeed. > > Thanks for your answers - much appreciated. > > So am I right in saying, I can use either the whiteboard extender OR the > war extender but not both (for the same bundle)? Is that a bug? :-) > > Concentrating on either WAB or a completely dynamic whiteboard bundle is not > a big problem (just a design decision), but it would be nice to have a WAB > with an Activator + whiteboard. But I do understand, we are constrained by > the OSGi specification for WABs. :-) > > Many thanks und schoene Gruesse aus Stuttgart, > -John > > -- > John Hawksley > john.hawks...@gmail.com > > > On Fri, May 6, 2011 at 09:03, Achim Nierbeck <bcanh...@googlemail.com> > wrote: >> >> Hi John, >> >> I'll answer your questions inline: >> >> regards, Achim >> >> 2011/5/5 John Hawksley <john.hawks...@gmail.com>: >> > Hi folks, >> > >> > Apologies if this has already been answered. I've been back through the >> > previous two quarters' messages and I didn't find anything pertinent. >> > >> >> np, feedback and questions are always welcome. >> >> > I'm having a play with the Pax Web War Extender, and I have got it >> > working >> > with a WAB. The WAB contains just a couple of JSP pages at this point, >> > as >> > well as a bundle activator, which registers a servlet via the Whiteboard >> > extender: >> > >> > Dictionary<String, String> props = new Hashtable<String, >> > String>(); >> > props.put( "alias", "/testservlet" ); >> > props.put( "servlet-name", "My Servlet" ); >> > sr = context.getBundleContext().registerService( >> > Servlet.class.getName(), servlet, props ); >> > >> > When this line is executed, Pax raises an IllegalArgumentException: >> > >> > ERROR: Bundle org.ops4j.pax.web.pax-web-extender-whiteboard [12] >> > EventDispatcher: Error during dispatch. >> > (java.lang.IllegalStateException: >> > Http context already used. Context params can be set only before first >> > usage) >> > java.lang.IllegalStateException: Http context already used. Context >> > params >> > can be set only before first usage >> > >> > I'll include the full trace at the end, in case it's useful. The JSP >> > works, >> > despite the exception, but the servlet doesn't. >> > >> > My working theory is that the WAR extender creates an HttpContext and >> > uses >> > this to serve the JSPs. When I then try to register my servlet, the >> > Whiteboard is using the same context. >> >> Your absolutely right here. The War extender creates the HttpContext >> and therefore it is already blocked. >> >> > >> > Am I doing something wrong? Is it possible to use both the extender and >> > the >> > whiteboard at the same time? >> >> no your not. >> The War extender usually does all you need for you, it's main purpose >> is to server WARs and WABs which are WARs with an OSGI Manifest Header >> but no Activator, :-) >> >> the War extender actually looks for a web.xml in the deployed bundles >> and starts those as WABs. So basically you don't need to use the >> Whiteboard extender >> since the War Extender uses the same mechanism inside. >> >> > >> > I have the following Pax bundles deployed in the latest Felix: >> > >> > OPS4J Pax Web - Extender - WAR (1.0.3) >> > OPS4J Pax Web - Extender - Whiteboard (1.0.3) >> > OPS4J Pax Web - Jetty Bundle (1.0.3) >> > OPS4J Pax Web - Jsp Support (1.0.3) >> > OPS4J Pax Web - Service SPI (1.0.3) >> >> If you don't have any other Whiteboard using bundles you might ignore >> the WhiteBoard one. >> >> If you are looking for a good OSGi Runtime with Pax-Web support I >> suggest you take a look at Apache Karaf, it already brings all these >> Bundles plus additional ones along. You also have special osgi shell >> commands for the war extender with Karaf in 2.2.x (2.2.1 is going to >> be release within the next week) does have the ability to list all >> webapp contexts with war:list >> With the next major release of Karaf 3.0 which is SNAPSHOT right now, >> you'll get the ability to stop and start certain webapp contexts. >> >> > >> > Many thanks everyone, any advice would be appreciated. Apologies if >> > gmail >> > has screwed up the formatting. >> > >> > -John >> > >> > ----------------8<--------------- >> > >> > ERROR: Bundle org.ops4j.pax.web.pax-web-extender-whiteboard [12] >> > EventDispatcher: Error during dispatch. >> > (java.lang.IllegalStateException: >> > Http context already used. Context params can be set only before first >> > usage) >> > java.lang.IllegalStateException: Http context already used. Context >> > params >> > can be set only before first usage >> > at >> > >> > org.ops4j.pax.web.service.internal.HttpServiceStarted.setContextParam(HttpServiceStarted.java:353) >> > at >> > >> > org.ops4j.pax.web.service.internal.HttpServiceProxy.setContextParam(HttpServiceProxy.java:174) >> > at >> > >> > org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerHttpContext(WebApplication.java:180) >> > at >> > >> > org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.setHttpContextMapping(WebApplication.java:147) >> > at >> > >> > org.ops4j.pax.web.extender.whiteboard.internal.ExtenderContext.getWebApplication(ExtenderContext.java:68) >> > at >> > >> > org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractTracker.addingService(AbstractTracker.java:135) >> > at >> > >> > org.ops4j.pax.web.extender.whiteboard.internal.tracker.ServletTracker.addingService(ServletTracker.java:42) >> > at >> > >> > org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896) >> > at >> > >> > org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261) >> > at >> > org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233) >> > at >> > >> > org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840) >> > at >> > >> > org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871) >> > at >> > >> > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733) >> > at >> > >> > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662) >> > at >> > org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3894) >> > at org.apache.felix.framework.Felix.access$000(Felix.java:79) >> > at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:722) >> > at >> > >> > org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:107) >> > at org.apache.felix.framework.Felix.registerService(Felix.java:2983) >> > at >> > >> > org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:310) >> > at >> > >> > org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:284) >> > at dam.ui.web.test.TestClass.activate(TestClass.java:50) >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> > at >> > >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> > at >> > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> > at java.lang.reflect.Method.invoke(Method.java:597) >> > at >> > >> > org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:227) >> > at >> > >> > org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38) >> > at >> > >> > org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:591) >> > at >> > org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:472) >> > at >> > >> > org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:146) >> > at >> > >> > org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:226) >> > at >> > >> > org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118) >> > at >> > >> > org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:1013) >> > at >> > >> > org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:333) >> > at >> > >> > org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:157) >> > at >> > >> > org.apache.felix.scr.impl.config.ImmediateComponentHolder.enableComponents(ImmediateComponentHolder.java:313) >> > at >> > >> > org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:253) >> > at >> > >> > org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147) >> > at >> > >> > org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111) >> > at >> > org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:274) >> > at >> > org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:192) >> > at >> > >> > org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807) >> > at >> > >> > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729) >> > at >> > >> > org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610) >> > at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3883) >> > at org.apache.felix.framework.Felix.startBundle(Felix.java:1797) >> > at >> > org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1173) >> > at >> > org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) >> > at java.lang.Thread.run(Thread.java:680) >> > >> > >> > -- >> > John Hawksley >> > john.hawks...@gmail.com >> > >> > _______________________________________________ >> > general mailing list >> > general@lists.ops4j.org >> > http://lists.ops4j.org/mailman/listinfo/general >> > >> > >> >> >> >> -- >> -- >> *Achim Nierbeck* >> >> >> Apache Karaf <http://karaf.apache.org/> Committer & PMC >> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> >> Committer & Project Lead >> >> _______________________________________________ >> general mailing list >> general@lists.ops4j.org >> http://lists.ops4j.org/mailman/listinfo/general > > > _______________________________________________ > general mailing list > general@lists.ops4j.org > http://lists.ops4j.org/mailman/listinfo/general > > -- -- *Achim Nierbeck* Apache Karaf <http://karaf.apache.org/> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead _______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general