0

WebServiceContext object is null when Soap Services are deployed on WebSphere V9.0.5.10 .

I am trying to migrate the SOAP Web Services from WebSphere V8.5.5.20 to V9.0.5.10 and one of Web service is using WebServiceContext object to get the message context. The WebServiceContext and MessageContext objects are created as follows -

@Resource
WebServiceContext ctx;

public void getHeaderData(){
     MessageContext msgctx =  ctx.getMessageContext();   /// ctx is NULL
}

However, this code works on WebSphere V8.5.5.20 but throws NULLPointerException on V9.0.5.10 as WebServiceContext object is null.

I tried to inject the WebService Context as -

WebServiceContext ctx;

@Resource
public WebServiceContext setContext(WebServiceContext ctx){
         this.ctx = ctx;
}

but this code did not work.

The Exception Stack trace is -

java.lang.NullPointerException : null
at com.app.soap.service.AppSoapWebService.getHeaderData(AppSoapWebService.java:1530)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90) ~[?:1.8.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) ~[?:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:508) ~[?:1.8.0]
at org.apache.axis2.jaxws.server.dispatcher.JavaDispatcher.invokeTargetOperation(JavaDispatcher.java:120) [org.apache.axis2.jar:?]
at org.apache.axis2.jaxws.server.dispatcher.JabaBeanDispatcher.invoke(JabaBeanDispatcher.java:118)
at org.apache.axis2.jaxws.server.dispatcher.EndpointController.invoke(EndpointController.java:111)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:212)
at org.apache.axis2.transport.http.HttpTransportUtil.processHTTPPostRequest(HttpTransportUtil.java:172)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1633)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilter(WebAppFilterManager.java:1134) 
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:82)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:966) 
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:382)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:532)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:318)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:289)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1187)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:694)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompltedCallback.complete(SSLReadServiceContext.java:1833)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1909)

Is there any fix available for this error ?

Thank you in advance.

Nilesh
  • 133
  • 3
  • 10
  • I'm wondering if you might be hitting a know issue not related to this APAR fix, easy way to tell is by asking you what version your web.xml is set to (assuming its not an EJB based Web Service)? – Thomas Johnson Mar 17 '22 at 14:22
  • Web.xml version is 3.0 – Nilesh Mar 21 '22 at 18:10
  • You might try upticking the web.xml version to 3.1 then, I've heard that resolved some WebServiceContext issues returning null on v9. If that doesn't work, would you mind posting the version of v9 you're on, and the stack trace for the NPE if possible? – Thomas Johnson Mar 23 '22 at 19:48
  • newly installed Websphere version is 9.0.5.10 whereas older websphere version is 8.5.5.20. Added stack trace for for NPE (My apologies for typos, if any. The could not copy the stack trace due to data restriction of my org, so I typed it.) – Nilesh Apr 05 '22 at 04:07

1 Answers1

0

You can open this link https://github.com/quarkiverse/quarkus-cxf/issues/92 in the answer section of neXus1987 (commented on Jan 11, 2021). Hope it can help your problem

Defandi
  • 124
  • 1
  • 6
  • I read the comment, but did not understand the expected code changes. Are you suggesting to use @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) ? Could you please explain ? – Nilesh Apr 05 '22 at 04:36