3 Replies Latest reply on Nov 6, 2007 3:10 PM by tmatynia

    NPE when call seam web service on glassfish

    hugo_th02

      I deploy seam 2.0 RC1 on glassfish and create a web service. When calling this web service, I get the NPE like this:


      [#|2007-09-22T10:14:31.156-0700|INFO|sun-appserver9.1|javax.enterprise.resource.webservices.jaxws.handler|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8280-0;|Exception ignored during close
      java.lang.NullPointerException
      at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:88)
      at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:25)
      at org.jboss.seam.contexts.BasicContext.set(BasicContext.java:80)
      at org.jboss.seam.Component.newInstance(Component.java:1976)
      at org.jboss.seam.Component.getInstance(Component.java:1874)
      at org.jboss.seam.Component.getInstance(Component.java:1853)
      at org.jboss.seam.Component.getInstance(Component.java:1830)
      at org.jboss.seam.web.Session.getInstance(Session.java:122)
      at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:375)
      at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:132)
      at nguyen.seam.demo.ws.util.SOAPRequestHandler.close(SOAPRequestHandler.java:159)
      at com.sun.xml.ws.handler.HandlerProcessor.closeHandlers(HandlerProcessor.java:414)
      at com.sun.xml.ws.handler.ServerSOAPHandlerTube.closeSOAPHandlers(ServerSOAPHandlerTube.java:146)
      at com.sun.xml.ws.handler.ServerSOAPHandlerTube.close(ServerSOAPHandlerTube.java:120)
      at com.sun.xml.ws.handler.HandlerTube.cleanUpState(HandlerTube.java:195)
      at com.sun.xml.ws.handler.HandlerTube.processResponse(HandlerTube.java:161)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:605)
      at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
      at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
      at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
      at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:106)
      at com.sun.enterprise.webservice.MonitoringPipe.process(MonitoringPipe.java:147)
      at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
      at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
      at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
      at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
      at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:106)
      at com.sun.xml.ws.tx.service.TxServerPipe.process(TxServerPipe.java:287)
      at com.sun.enterprise.webservice.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:218)
      at com.sun.enterprise.webservice.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:129)
      at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
      at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
      at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
      at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
      at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
      at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
      at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
      at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
      at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:113)
      at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:87)
      at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:200)
      at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:129)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
      at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.java:114)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:87)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
      at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
      |#]

      [#|2007-09-22T10:14:31.156-0700|WARNING|sun-appserver9.1|javax.enterprise.resource.webservices.jaxws.wstx|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8280-0;_RequestID=0a9fd8f9-ab54-4cc5-9d56-74c88e6d337a;|WSTX-SERVICE-5013: Handling exception to complete WS-TX processing of WS-TX coordId= 'uuid:WSCOOR-SUN-fb5aefb8-ebee-45ce-8a72-fa965bf8e02d', imported JTA transaction='J2EETransaction: txId=7 nonXAResource=null jtsTx=com.sun.jts.jta.TransactionImpl@5b142a09 localTxStatus=0 syncs=[]}'
      java.lang.NullPointerException
      at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:88)
      at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:25)
      at org.jboss.seam.contexts.BasicContext.set(BasicContext.java:80)
      at org.jboss.seam.Component.newInstance(Component.java:1976)
      at org.jboss.seam.Component.getInstance(Component.java:1874)
      at org.jboss.seam.Component.getInstance(Component.java:1853)
      at org.jboss.seam.Component.getInstance(Component.java:1830)
      at org.jboss.seam.core.ConversationEntries.getInstance(ConversationEntries.java:103)
      at org.jboss.seam.core.Manager.removeCurrentConversationAndDestroyNestedContexts(Manager.java:369)
      at org.jboss.seam.core.Manager.endRequest(Manager.java:338)
      at nguyen.seam.demo.ws.util.SOAPRequestHandler.handleOutbound(SOAPRequestHandler.java:117)
      at nguyen.seam.demo.ws.util.SOAPRequestHandler.handleMessage(SOAPRequestHandler.java:56)
      at com.sun.xml.ws.handler.HandlerProcessor.callHandleMessageReverse(HandlerProcessor.java:336)
      at com.sun.xml.ws.handler.HandlerProcessor.callHandlersResponse(HandlerProcessor.java:207)
      at com.sun.xml.ws.handler.ServerSOAPHandlerTube.callHandlersOnResponse(ServerSOAPHandlerTube.java:206)
      at com.sun.xml.ws.handler.HandlerTube.processResponse(HandlerTube.java:158)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:605)
      at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
      at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
      at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
      at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:106)
      at com.sun.enterprise.webservice.MonitoringPipe.process(MonitoringPipe.java:147)
      at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
      at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
      at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
      at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
      at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:106)
      at com.sun.xml.ws.tx.service.TxServerPipe.process(TxServerPipe.java:287)
      at com.sun.enterprise.webservice.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:218)
      at com.sun.enterprise.webservice.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:129)
      at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
      at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
      at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
      at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
      at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
      at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
      at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
      at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
      at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
      at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:113)
      at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:87)
      at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:200)
      at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:129)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
      at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.java:114)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:87)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
      at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
      |#]

      [#|2007-09-22T10:14:31.375-0700|SEVERE|sun-appserver9.1|javax.enterprise.resource.webservices.jaxws.wstx.wsat|_ThreadID=17;_ThreadName=httpSSLWorkerThread-2569-1;_RequestID=7d122cb0-394d-43b7-bfe1-b1c64c863a5e;|WSTX-AT-0026: XATerminator abort. coordId='uuid:WSCOOR-SUN-fb5aefb8-ebee-45ce-8a72-fa965bf8e02d'|#]


      It seems that there no HttpSession along with the MessageContext when the SOAPRequestHandler init the seam context. So, when call Contexts.flushAndDestroyContexts() in SOAPRequestHandler.close(), the NPE was throwed.
      Can anyone help me?
      Thanks

        • 1. Re: NPE when call seam web service on glassfish
          hugo_th02

          Hi, all.
          I've found the link: https://glassfish.dev.java.net/javaee5/webservices/dispatch_process.html


          When the EjbWebServiceServlet instance receives a SOAP/HTTP or XML/HTTP message (as HTTPServletRequest), it does the following:

          1. Looks up the endpoint descriptor (EjbRuntimeEndpointInfo) from the EJB endpoint registry (WebServiceEjbEndpointRegistry).
          2. Performs authentication as described in JSR-109 Section 9.
          3. Passes the HTTPServletRequest and HTTPServletResponse, along with the endpoint descriptor to an appropriate (i.e., either JAX-RPC or JAX-WS) dispatcher (EjbMessageDispatcher) for processing

          The EjbMessageDispatcher processing is similar to the dispatching performed by JAXWSServlet, and includes the following steps:

          1. Creates the MessageContext (without a reference to the ServletContext).
          2. Passes the HTTP request/response objects, along with the RuntimeEndpointInfo, to an instance of com.sun.xml.ws.spi.runtime.Tie - the entry point for the JAX-WS runtime system.
          3. The JAX-WS runtime decodes the SOAP request, applying the JAX-WS and JAXB XML/Java bindings, to get the parameters that are used to invoke the endpoint implementation class.
          4. Then, the flow is reversed and the returned object is serialized back out to the HTTP response.


          Is that the reason why there no session in SOAPRequestHandler?
          If so, how can I call seam web service on glassfish?

          Thanks


          • 2. Re: NPE when call seam web service on glassfish
            tmatynia

            Hi, all.
            I have exactly the same problem. I tried to find out any workaround, but with no success.

            Have You managed this exception?

            Please, give me know!

            Thanks

            • 3. Re: NPE when call seam web service on glassfish
              tmatynia

              Well my webservice is meant to work asynchronously, it only receives data, and returns almost always 0.

              If I make workaround like:
              - I leave webservice as plain odl ejb3 :), but not a Seam component
              - I create a Seam/MDB
              - then I dispatch every data posted to webservice to a queue, and process it in Seam/MDB

              will I be able to @In application scoped components in MDB? Because in reference docs I read (3.5.2):

              Message-driven beans may not be bound to a Seam context. Nor do they have access to the session or conversation state of their "caller". However, they do support bijection and some other Seam functionality.


              Anybody, will that work?

              Thanks in advance!