You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by asookazian <as...@gmail.com> on 2015/05/06 22:13:42 UTC

WebServiceContext is null after upgrading to Karaf 3.0.3

Suddenly we are getting NPE for WebServiceContext instance in code that has
not changed before or after the Karaf 3.0.3 upgrade (culprit most likely is
cxf 3.0.4).  This is causing a web service call from web client to fail. 

We are using following code: 

javax.xml.ws.WebServiceContext foo; 

Considering replacing with following code (as we really only need
MessageContext to get HTTP request headers): 

@Resource 
javax.xml.ws.handler.MessageContext foo; 

http://t80463.apache-cxf-user.apachetalks.us/webservicecontext-is-null-t80463.html

@Context is specific to JAXRS and this is a SOAP WS, so out of scope.

any help appreciated.  thx.



--
View this message in context: http://cxf.547215.n5.nabble.com/WebServiceContext-is-null-after-upgrading-to-Karaf-3-0-3-tp5757099.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: WebServiceContext is null after upgrading to Karaf 3.0.3

Posted by asookazian <as...@gmail.com>.
trying this:

@Resource
	@WebMethod(exclude = true)
    public void setContext(WebServiceContext context) {
        this.context = context;
    }



--
View this message in context: http://cxf.547215.n5.nabble.com/WebServiceContext-is-null-after-upgrading-to-Karaf-3-0-3-tp5757099p5757107.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: WebServiceContext is null after upgrading to Karaf 3.0.3

Posted by asookazian <as...@gmail.com>.
tried setter injection and get mvn build error...

private WebServiceContext context;
	
	@Resource
    public void setContext(WebServiceContext context) {
        this.context = context;
    }



java.lang.RuntimeException:
org.apache.cxf.service.factory.ServiceConstructionException
	at
org.apache.cxf.frontend.AbstractServiceFactory.createService(AbstractServiceFactory.java:80)
	at
org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(JavaToWSDLProcessor.java:101)
	at
org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSContainer.java:110)
	at
org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:75)
	at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
	at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:58)
	at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:40)
	at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:77)
	at
org.apache.cxf.maven_plugin.Java2WSMojo.processJavaClass(Java2WSMojo.java:363)
	at org.apache.cxf.maven_plugin.Java2WSMojo.execute(Java2WSMojo.java:231)
	at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:341)
	at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:490)
	at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:704)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:550)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
	at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
	at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
	at
org.apache.cxf.frontend.AbstractServiceFactory.createService(AbstractServiceFactory.java:78)
	... 30 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle
interfaces.
	this problem is related to the following location:
		at javax.xml.ws.WebServiceContext
		at private javax.xml.ws.WebServiceContext
com.nextgate.mm.workflow.ws.server.jaxws_asm.SetContext.arg0
		at com.nextgate.mm.workflow.ws.server.jaxws_asm.SetContext

	at
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
	at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:471)
	at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:303)
	at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:142)
	at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1174)
	at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:162)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:248)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:235)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:432)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637)
	at
org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:345)
	at
org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:343)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:343)
	at
org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:244)
	at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:484)
	at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:339)
	... 38 more




--
View this message in context: http://cxf.547215.n5.nabble.com/WebServiceContext-is-null-after-upgrading-to-Karaf-3-0-3-tp5757099p5757106.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: WebServiceContext is null after upgrading to Karaf 3.0.3

Posted by asookazian <as...@gmail.com>.
http://cxf.apache.org/docs/webservicecontext.html

the example code in page above is using:

@Resource
WebServiceContext wsContext;

which is what we are using and now suddenly not working after cxf upgrade. 
is there some config required?  which version of cxf is this code applicable
for?  thx.



--
View this message in context: http://cxf.547215.n5.nabble.com/WebServiceContext-is-null-after-upgrading-to-Karaf-3-0-3-tp5757099p5757105.html
Sent from the cxf-user mailing list archive at Nabble.com.