Xavier Dury [
https://community.jboss.org/people/xdury] created the discussion
"NullPointerException in JAXWSMetaDataBuilder"
To view the discussion, visit:
https://community.jboss.org/message/772265#772265
--------------------------------------------------------------
Hi,
I'm using jboss 5.1.0 and I'm trying to attach a custom SOAPHandler to a
WebService reference injected in an EJB:
@Stateless
public class MyServiceBean implements MyService {
@WebServiceRef(name = "services/MyWebService")
private MyWebServicePortType myWebService;
}
in jboss.xml:
<session>
<ejb-name>MyServiceBean </ejb-name>
<service-ref>
<service-ref-name>services/MyWebService</service-ref-name>
<service-qname>{
http://mycompany.com/MyWebService
http://mycompany.com/MyWebService}MyWebService</service-qname>
<handler-chain>jbossws-client-handlers.xml</handler-chain>
<wsdl-override>
http://myserver/myservice?wsdl
http://myserver/myservice?wsdl</wsdl-override>
</service-ref>
</session>
When I call a method on my EJB which uses the WS, I get:
java.lang.RuntimeException: Unable to inject jndi dependency: env/services/MyWebService
into property com.mycompany.MyServiceBean.myWebService: null
at
org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82)
at
org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)
at
org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
at
org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61)
at
org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:89)
at
org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:83)
at
org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at
org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:74)
at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1086)
at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:83)
at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.ejb3.security.RunAsSecurityInterceptorv2.invoke(RunAsSecurityInterceptorv2.java:94)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at
org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:176)
at
org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:216)
at
org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
at
org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
...
Caused by: javax.naming.NamingException: Could not dereference object [Root exception is
org.jboss.ws.WSException: Cannot create service]
at
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1504)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
at
org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
... 161 more
Caused by: org.jboss.ws.WSException: Cannot create service
at org.jboss.ws.WSException.rethrow(WSException.java:60)
at
org.jboss.ws.core.jaxws.client.ServiceObjectFactoryJAXWS.getObjectInstance(ServiceObjectFactoryJAXWS.java:192)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479)
at
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496)
... 165 more
Caused by: java.lang.NullPointerException
at
org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.getHandlerChainsMetaData(JAXWSMetaDataBuilder.java:221)
at
org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:157)
at
org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63)
at javax.xml.ws.Service.<init>(Service.java:79)
at javax.xml.ws.Service.create(Service.java:96)
at
org.jboss.ws.core.jaxws.client.ServiceObjectFactoryJAXWS.getObjectInstance(ServiceObjectFactoryJAXWS.java:126)
... 168 more
It seems that JAXWSMetaDataBuilder.getHandlerChainsMetaData() receives
javax.xml.ws.Service as wsClass parameter.
To load the handlers-chain file, JAXWSMetaDataBuilder tries to use
wsClass.getClassloader().getResource(filename) but the returned classloader is null.
The comment on Class.getClassloader() says: "Returns the class loader for the class.
Some implementations may use *null* to represent the bootstrap class loader. This method
will return null in such implementations if this class was loaded by the bootstrap class
loader."
That's normal because javax.xml.ws.Service is part of jdk6+.
I checked all versions of jbossws-native-cores (up to 4+) and all versions seem to do the
same thing.
Is there any way to prevent that NPE or is it a bug that can't be avoided?
Regards,
Xavier
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/772265#772265]
Start a new discussion in JBoss Web Services at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]