Hi Ralf, I'm not so sure about that spring-ws servlet. Cause usually for Spring to work properly in OSGi you also need Spring-DM. There are two samples available on how to use Spring with Pax-Web. One needs Spring-DM as it uses other OSGi means to import dependencies [1]. The other one embeds all Spring related dependencies and therefore doesn't need extra Spring-DM contexts. So in your case I guess you need to make sure that spring-DM is also installed and used, or use CXF for example as alternate webservice implementation. It's known to work very well with camel and OSGi.
regards, Achim 2015-08-27 9:14 GMT+02:00 rsteppac <[email protected]>: > Achim, > > thanks for your reply. I am using Camel 2.15.2 and Karaf 4.0.1. The error I > am receiving is the same NPE as reported by Mario. This is the feature file > I am trying to deploy: > > <feature name="pas-webservice-hp" description="PAS Webservice for HPs" > version="4.0.0.SNAPSHOT"> > <details>Webservice API for health professional related use > cases</details> > <feature prerequisite="false" dependency="false">http</feature> > <feature prerequisite="false" > dependency="false">http-whiteboard</feature> > <feature version="2.15.2" prerequisite="false" > dependency="false">camel-core</feature> > <feature version="2.15.2" prerequisite="false" > dependency="false">camel-spring</feature> > <feature version="2.15.2" prerequisite="false" > dependency="false">camel-blueprint</feature> > <feature version="2.15.2" prerequisite="false" > dependency="false">camel-xmpp</feature> > <feature version="2.15.2" prerequisite="false" > dependency="false">camel-spring-ws</feature> > <feature version="2.15.2" prerequisite="false" > dependency="false">camel-jaxb</feature> > <bundle > dependency="true">mvn:ch.vivates.ams/base/4.0.0-SNAPSHOT</bundle> > > <bundle>mvn:ch.vivates.ams/pas-webservice-hp/4.0.0-SNAPSHOT</bundle> > <bundle>mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1</bundle> > <bundle>mvn:org.codehaus.woodstox/stax2-api/3.1.4</bundle> > <bundle>mvn:joda-time/joda-time/2.7</bundle> > </feature> > > Everything appears to go well up to the point where the spring-ws servlet > is > published to the http-whiteboard service. This is how the blueprint > fragment > looks like: > > <bean id="pas-ws-hp-servlet" > class="org.springframework.ws.transport.http.MessageDispatcherServlet"> > <property name="contextConfigLocation" > value="spring-ws-servlet-context.xml" /> > <property name="contextInitializers"> > <list> > <ref > component-id="springWsContextInitializer" /> > </list> > </property> > <property name="transformWsdlLocations" value="true" /> > <property name="transformSchemaLocations" value="true" /> > </bean> > > <service ref="pas-ws-hp-servlet" > interface="javax.servlet.http.HttpServlet"> > <service-properties> > <entry key="alias" > value="/${pas.ws.hp.contextroot}" /> > <entry key="servlet-name" > value="pas-ws-hp-servlet" /> > </service-properties> > </service> > > > And the error in the Karaf log: > > 2015-08-27 09:04:08,380 | INFO | pool-27-thread-1 | BlueprintCamelContext > | 60 - org.apache.camel.camel-core - 2.15.2 | | Apache Camel 2.15.2 > (CamelContext: pas-hp-ws) started in 1.231 seconds > 2015-08-27 09:04:08,411 | INFO | pool-27-thread-1 | HttpServiceFactoryImpl > | 122 - org.ops4j.pax.web.pax-web-runtime - 4.2.0 | | Binding bundle: > [ch.vivates.ams.pas-webservice-hp [52]] to http service > 2015-08-27 09:04:08,456 | INFO | pool-27-thread-1 | JettyServerWrapper > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | will add > org.springframework.web.SpringServletContainerInitializer to > ServletContainerInitializers > 2015-08-27 09:04:08,644 | INFO | pool-27-thread-1 | JettyServerWrapper > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | added > ServletContainerInitializer: > org.springframework.web.SpringServletContainerInitializer > 2015-08-27 09:04:08,644 | INFO | pool-27-thread-1 | JettyServerWrapper > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | will add > > org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer > to ServletContainerInitializers > 2015-08-27 09:04:08,873 | INFO | pool-27-thread-1 | JettyServerWrapper > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | added > ServletContainerInitializer: > > org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer > 2015-08-27 09:04:08,873 | INFO | pool-27-thread-1 | JettyServerWrapper > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | will add > org.apache.jasper.servlet.JasperInitializer to ServletContainerInitializers > 2015-08-27 09:04:08,874 | INFO | pool-27-thread-1 | JettyServerWrapper > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | Skipt > org.apache.jasper.servlet.JasperInitializer, because specialized handler > will be present > 2015-08-27 09:04:08,926 | INFO | pool-27-thread-1 | HttpServiceContext > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | registering context > DefaultHttpContext [bundle=ch.vivates.ams.pas-webservice-hp [52], > contextID=default], with context-name: > 2015-08-27 09:04:08,935 | INFO | pool-27-thread-1 | HttpServiceContext > | 120 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | | registering > JasperInitializer > 2015-08-27 09:04:08,942 | WARN | pool-27-thread-1 | AbstractLifeCycle > | 104 - org.eclipse.jetty.util - 9.2.10.v20150310 | | FAILED > HttpServiceContext{httpContext=DefaultHttpContext > [bundle=ch.vivates.ams.pas-webservice-hp [52], contextID=default]}: > java.lang.NullPointerException > java.lang.NullPointerException > at > > org.eclipse.jetty.server.handler.ContextHandler$Context.log(ContextHandler.java:2052)[101:org.eclipse.jetty.server:9.2.10.v20150310] > at > > org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:166)[84:org.apache.servicemix.bundles.spring-web:3.2.14.RELEASE_1] > at > > org.ops4j.pax.web.service.jetty.internal.HttpServiceContext$1.call(HttpServiceContext.java:188)[120:org.ops4j.pax.web.pax-web-jetty:4.2.0] > at > > org.ops4j.pax.web.service.jetty.internal.HttpServiceContext$1.call(HttpServiceContext.java:183)[120:org.ops4j.pax.web.pax-web-jetty:4.2.0] > at > > org.ops4j.pax.swissbox.core.ContextClassLoaderUtils.doWithClassLoader(ContextClassLoaderUtils.java:60)[120:org.ops4j.pax.web.pax-web-jetty:4.2.0] > at > > org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doStart(HttpServiceContext.java:182)[120:org.ops4j.pax.web.pax-web-jetty:4.2.0] > at > > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)[104:org.eclipse.jetty.util:9.2.10.v20150310] > at > > org.ops4j.pax.web.service.jetty.internal.JettyServerImpl$1.start(JettyServerImpl.java:258)[120:org.ops4j.pax.web.pax-web-jetty:4.2.0] > at > > org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:216)[122:org.ops4j.pax.web.pax-web-runtime:4.2.0] > at > > org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:190)[122:org.ops4j.pax.web.pax-web-runtime:4.2.0] > at > > org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:175)[122:org.ops4j.pax.web.pax-web-runtime:4.2.0] > at > > org.ops4j.pax.web.service.internal.HttpServiceProxy.registerServlet(HttpServiceProxy.java:64)[122:org.ops4j.pax.web.pax-web-runtime:4.2.0] > at > > org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:61)[119:org.ops4j.pax.web.pax-web-extender-whiteboard:4.2.0] > at > > org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElement(WebApplication.java:270)[119:org.ops4j.pax.web.pax-web-extender-whiteboard:4.2.0] > at > > org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.addWebElement(WebApplication.java:127)[119:org.ops4j.pax.web.pax-web-extender-whiteboard:4.2.0] > at > > org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractTracker.addingService(AbstractTracker.java:167)[119:org.ops4j.pax.web.pax-web-extender-whiteboard:4.2.0] > at > > org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractTracker.addingService(AbstractTracker.java:42)[119:org.ops4j.pax.web.pax-web-extender-whiteboard:4.2.0] > at > > org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)[org.osgi.core-6.0.0.jar:] > at > > org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)[org.osgi.core-6.0.0.jar:] > at > > org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:] > at > > org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)[org.osgi.core-6.0.0.jar:] > at > > org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)[org.osgi.core-6.0.0.jar:] > at > > org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:987)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4560)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.Felix.registerService(Felix.java:3542)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:453)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.blueprint.container.ServiceRecipe.register(ServiceRecipe.java:192)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.blueprint.container.BlueprintContainerImpl.registerServices(BlueprintContainerImpl.java:704)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:379)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)[12:org.apache.aries.blueprint.core:1.4.3] > at > > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[21:org.apache.aries.util:1.1.0] > at > > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[21:org.apache.aries.util:1.1.0] > at > > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[21:org.apache.aries.util:1.1.0] > at > > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[21:org.apache.aries.util:1.1.0] > at > > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[21:org.apache.aries.util:1.1.0] > at > > org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4544)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.Felix.startBundle(Felix.java:2166)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964)[org.apache.felix.framework-5.0.1.jar:] > at > > org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1189)[8:org.apache.karaf.features.core:4.0.1] > at > > org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:836)[8:org.apache.karaf.features.core:4.0.1] > at > > org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[8:org.apache.karaf.features.core:4.0.1] > at > > org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[8:org.apache.karaf.features.core:4.0.1] > at > java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_40] > at > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_40] > at > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_40] > at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] > 2015-08-27 09:04:08,944 | ERROR | pool-27-thread-1 | HttpServiceStarted > | 122 - org.ops4j.pax.web.pax-web-runtime - 4.2.0 | | Could not start the > servlet context for context path [] > > > The bundles that were installed for the feature: > > karaf@root()> bundle:list > START LEVEL 100 , List Threshold: 50 > ID | State | Lvl | Version | Name > > ------------------------------------------------------------------------------- > 51 | Active | 80 | 4.0.0.SNAPSHOT | Base > 52 | Active | 80 | 4.0.0.SNAPSHOT | Webservice Health Professionals > 53 | Active | 80 | 1.4.7 | JavaMail API (compat) > 56 | Active | 80 | 2.7 | Joda-Time > 57 | Active | 80 | 2.15.2 | camel-blueprint > 58 | Active | 80 | 2.15.2 | camel-catalog > 59 | Active | 80 | 2.15.2 | camel-commands-core > 60 | Active | 80 | 2.15.2 | camel-core > 61 | Active | 80 | 2.15.2 | camel-jaxb > 62 | Active | 80 | 2.15.2 | camel-spring > 63 | Active | 80 | 2.15.2 | camel-spring-ws > 64 | Active | 80 | 2.15.2 | camel-xmpp > 65 | Active | 80 | 2.15.2 | camel-karaf-commands > 74 | Active | 80 | 2.2.6.1 | Apache ServiceMix :: Bundles :: > jaxb-impl > 86 | Active | 80 | 1.1.4.c | Apache ServiceMix :: Bundles :: xpp3 > 115 | Active | 80 | 4.0.7 | smack-core > 116 | Active | 80 | 4.0.7 | smack-extensions > 117 | Active | 80 | 4.0.7 | smack-tcp > 128 | Active | 80 | 2.1.4.RELEASE | Spring Web Services Core > 129 | Active | 80 | 2.1.4.RELEASE | Spring XML > 130 | Active | 80 | 3.1.4 | Stax2 API > 131 | Active | 80 | 4.4.1 | Woodstox XML-processor > > > HTH, > Ralf > > > > -- > View this message in context: > http://karaf.922171.n3.nabble.com/Nullpointer-Exception-in-jetty-ContextHandler-on-4-0-0-M2-and-M3-tp4041050p4042076.html > Sent from the Karaf - User mailing list archive at Nabble.com. > -- Apache Member Apache Karaf <http://karaf.apache.org/> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead blog <http://notizblog.nierbeck.de/> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS> Software Architect / Project Manager / Scrum Master
