Emil Bergner created CXF-4526:
---------------------------------
Summary: PolicyAnnotationListener throws NPE in jar
Key: CXF-4526
URL: https://issues.apache.org/jira/browse/CXF-4526
Project: CXF
Issue Type: Bug
Components: WS-* Components
Affects Versions: 2.6.2
Reporter: Emil Bergner
Priority: Minor
I've attached a security policy to my service using:
@Policy(uri = "classpath:some-security-policy.xml", placement =
Policy.Placement.DEFAULT)
Everything works fine inside Eclipse. But an NPE is thrown in
PolicyAnnotationListener on line 348 when I run the executable jar that I build
with maven-shade-plugin:
Exception in thread "main" javax.xml.ws.WebServiceException:
java.lang.NullPointerException
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:357)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:246)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:525)
at com.reverb.ison.ws.InteliSonServer.publish(InteliSonServer.java:21)
at com.reverb.ison.ws.InteliSonServer.main(InteliSonServer.java:15)
Caused by: java.lang.NullPointerException
at
org.apache.cxf.ws.policy.PolicyAnnotationListener.addPolicy(PolicyAnnotationListener.java:348)
at
org.apache.cxf.ws.policy.PolicyAnnotationListener.addPolicy(PolicyAnnotationListener.java:328)
at
org.apache.cxf.ws.policy.PolicyAnnotationListener.addPolicies(PolicyAnnotationListener.java:249)
at
org.apache.cxf.ws.policy.PolicyAnnotationListener.addPolicies(PolicyAnnotationListener.java:165)
at
org.apache.cxf.ws.policy.PolicyAnnotationListener.handleEvent(PolicyAnnotationListener.java:77)
at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.sendEvent(AbstractServiceFactoryBean.java:72)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:200)
at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:442)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:329)
... 4 more
Looks like the issue is:
cls.getResource("/").toString()
which will return null when the class is inside a jar.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira