You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-user@ws.apache.org by Zi Qiang Yang <ya...@cn.ibm.com> on 2005/12/05 12:37:31 UTC

one-way MEP throws NPE

Hi,

In org.apache.ws.resource.handler.ResourceHandler.handleResponse( 
MessageContext msgContext ) we can see the following snippet:
         ...
         else // one-way MEP
         {
            // a null message tells the SOAP engine to return an empty 
HTTP response with a 202 status code
            ( (SOAPMessageContext) msgContext ).setMessage( null );
         }
          ...
While in org.apache.axis.MessageContext we can see the following snippet:
    public void setMessage(SOAPMessage message)
    {
        setCurrentMessage((Message)message);
    }

    public void setCurrentMessage(Message curMsg)
    {
        curMsg.setMessageContext(this);
        if(havePassedPivot)
            responseMessage = curMsg;
        else
            requestMessage = curMsg;
    }

Obviously, for one-way MEP, a NPE will be thrown when the following line 
is executed:
    curMsg.setMessageContext(this);

We can reproduce this issue with the "filesystem" and "consume" provided 
by pubscribe:
   1. access http://localhost:8080/pubscribe/notifproducer.jsp
   2. click "Trigger Notification !"
   3. In the console (System.out), we can get the following stack trace:
java.lang.NullPointerException
        at 
org.apache.axis.MessageContext.setCurrentMessage(MessageContext.java:630)
        at 
org.apache.axis.MessageContext.setMessage(MessageContext.java:648)
        at 
org.apache.ws.resource.handler.ResourceHandler.handleResponse(ResourceHandler.java:239)
        at 
org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:210)
        at 
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at 
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
        at 
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at 
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at 
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
        at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
 
Best Regards,

Yang Ziqiang (杨自强)
IBM China Software Development Lab
Tel: (86-10) 82782244-2671
Fax: (86-10) 82782244-2886
Email: yangziq@cn.ibm.com 
Address: 2/F, Deshi Building, No. 9, East Road, ShangDi, Beijing 100085, 
P.R.China


Re: one-way MEP throws NPE

Posted by Ciprian Ciubotariu <ci...@softnrg.dnttm.ro>.
How does one refer to another message? I'm not a maintainer, but here's
another conversation from this mailing list on the subject:



-------- Original Message --------
Subject: 	Re: Bug in WSRF for 1-way MEPs
Date: 	Tue, 22 Nov 2005 15:10:11 -0500
From: 	Ian Springer <ip...@apache.org>
Reply-To: 	wsrf-user@ws.apache.org
To: 	pubscribe-user@ws.apache.org
CC: 	WSRF Mailing List <ws...@ws.apache.org>
References: 	<43...@softnrg.dnttm.ro>



Hi Cipi,

Thanks, I've applied your patch.

It looks like someone removed the jsr173 API jar from 
http://www.ibiblio.org/maven/xmlbeans/jars/, but I discovered 
http://www.ibiblio.org/maven/stax/jars/stax-api-1.0.jar, which ought to 
be a suitable replacement. I modified the WSRF and Pubscribe 
project.xml's to point to that location.

As for the recent lack of activity in the project, I can only speak for 
those committers employed by HP. We've been unable to devote much time 
to the project recently because our management has been pulling us in 
other directions. We hope to be able to eventually become more active 
again, but in the meantime, we'll at least try to stay on top of the 
mailing lists and bugs in JIRA.

Regards,
Ian

Ciprian Ciubotariu wrote:
> Hi.
>
> I've corrected the ResourceHandler in WSRF-1.1 to no longer fault on
> 1-way MEPs (like the standard notify message in WS-Notification
> NotificationConsumer interface, for instance). Apparently the response
> message in the messageContext is already null, and there's no need to
> set it to null (which axis does by calling message.setMessageContext,
> where message == null), so by commenting the offending line the notify
> implementation no longer faults and the reply is HTTP 202 (I haven't
> checked the specs, but everything seems to be OK from the client side).
>
> The patch is attached (it's text and easy to read by humans if you don't
> want to patch -p1 < wsrf-1.1.patch). Oh, also the build process is
> broken, so the patch includes my hacks to make it work on my machine
> (well, it works after manually downloading xmlbeans, renaming
> jsr173_0.1_api.jar to jsr173-0.1_api.jar and copying it to the maven
> repository in the xmlbeans directory, but hey... it builds).
>
> Yours,
>
> Cipi
>
> P.S. Is there any activity on this project? Because the #apache-ws
> channel is empty, mailing lists are low on info, bug tracking DBs seem
> to be deserted by maintainers, the source distribution cannot be built etc.
>   
> ------------------------------------------------------------------------
>
> diff -Naur wsrf-src-1.1/project.xml wsrf-src-1.1-corrected/project.xml
> --- wsrf-src-1.1/project.xml	2005-10-25 12:37:10.000000000 +0300
> +++ wsrf-src-1.1-corrected/project.xml	2005-11-18 15:32:49.014558300 +0200
> @@ -451,8 +451,8 @@
>  
>      <dependency>
>        <groupId>xmlbeans</groupId>
> -      <artifactId>xmlbeans-jsr173-api</artifactId>
> -      <version>2.0-dev</version>
> +      <artifactId>jsr173</artifactId>
> +      <version>1.0_api</version>
>        <url>http://xmlbeans.apache.org/</url>
>        <properties>
>          <license>ApacheLicense-2.0.txt</license>
> diff -Naur wsrf-src-1.1/src/java/org/apache/ws/resource/handler/ResourceHandler.java wsrf-src-1.1-corrected/src/java/org/apache/ws/resource/handler/ResourceHandler.java
> --- wsrf-src-1.1/src/java/org/apache/ws/resource/handler/ResourceHandler.java	2005-10-25 12:37:40.000000000 +0300
> +++ wsrf-src-1.1-corrected/src/java/org/apache/ws/resource/handler/ResourceHandler.java	2005-11-18 15:48:29.271737100 +0200
> @@ -236,7 +236,7 @@
>           else // one-way MEP
>           {
>              // a null message tells the SOAP engine to return an empty HTTP response with a 202 status code
> -            ( (SOAPMessageContext) msgContext ).setMessage( null );
> +//            ( (SOAPMessageContext) msgContext ).setMessage( null );
>           }
>        }
>        catch ( Exception e )
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org




Davanum Srinivas wrote:

>You are right, please submit a bug report in JIRA with a patch against
>latest SVN.
>
>thanks,
>dims
>
>On 12/5/05, Zi Qiang Yang <ya...@cn.ibm.com> wrote:
>  
>
>>Hi,
>>
>>In org.apache.ws.resource.handler.ResourceHandler.handleResponse(
>>MessageContext msgContext ) we can see the following snippet:
>>         ...
>>         else // one-way MEP
>>         {
>>            // a null message tells the SOAP engine to return an empty
>>HTTP response with a 202 status code
>>            ( (SOAPMessageContext) msgContext ).setMessage( null );
>>         }
>>          ...
>>While in org.apache.axis.MessageContext we can see the following snippet:
>>    public void setMessage(SOAPMessage message)
>>    {
>>        setCurrentMessage((Message)message);
>>    }
>>
>>    public void setCurrentMessage(Message curMsg)
>>    {
>>        curMsg.setMessageContext(this);
>>        if(havePassedPivot)
>>            responseMessage = curMsg;
>>        else
>>            requestMessage = curMsg;
>>    }
>>
>>Obviously, for one-way MEP, a NPE will be thrown when the following line
>>is executed:
>>    curMsg.setMessageContext(this);
>>
>>We can reproduce this issue with the "filesystem" and "consume" provided
>>by pubscribe:
>>   1. access http://localhost:8080/pubscribe/notifproducer.jsp
>>   2. click "Trigger Notification !"
>>   3. In the console (System.out), we can get the following stack trace:
>>java.lang.NullPointerException
>>        at
>>org.apache.axis.MessageContext.setCurrentMessage(MessageContext.java:630)
>>        at
>>org.apache.axis.MessageContext.setMessage(MessageContext.java:648)
>>        at
>>org.apache.ws.resource.handler.ResourceHandler.handleResponse(ResourceHandler.java:239)
>>        at
>>org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:210)
>>        at
>>org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>>        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>>        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>>        at
>>org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>>        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>>        at
>>org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>>        at
>>org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>>        at
>>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>>        at
>>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>>        at
>>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
>>        at
>>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>>        at
>>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
>>        at
>>org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
>>        at
>>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
>>        at
>>org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
>>
>>Best Regards,
>>
>>Yang Ziqiang (杨自强)
>>IBM China Software Development Lab
>>Tel: (86-10) 82782244-2671
>>Fax: (86-10) 82782244-2886
>>Email: yangziq@cn.ibm.com
>>Address: 2/F, Deshi Building, No. 9, East Road, ShangDi, Beijing 100085,
>>P.R.China
>>
>>
>>    
>>
>
>
>--
>Davanum Srinivas : http://wso2.com/blogs/
>
>  
>

Re: one-way MEP throws NPE

Posted by Davanum Srinivas <da...@gmail.com>.
You are right, please submit a bug report in JIRA with a patch against
latest SVN.

thanks,
dims

On 12/5/05, Zi Qiang Yang <ya...@cn.ibm.com> wrote:
> Hi,
>
> In org.apache.ws.resource.handler.ResourceHandler.handleResponse(
> MessageContext msgContext ) we can see the following snippet:
>          ...
>          else // one-way MEP
>          {
>             // a null message tells the SOAP engine to return an empty
> HTTP response with a 202 status code
>             ( (SOAPMessageContext) msgContext ).setMessage( null );
>          }
>           ...
> While in org.apache.axis.MessageContext we can see the following snippet:
>     public void setMessage(SOAPMessage message)
>     {
>         setCurrentMessage((Message)message);
>     }
>
>     public void setCurrentMessage(Message curMsg)
>     {
>         curMsg.setMessageContext(this);
>         if(havePassedPivot)
>             responseMessage = curMsg;
>         else
>             requestMessage = curMsg;
>     }
>
> Obviously, for one-way MEP, a NPE will be thrown when the following line
> is executed:
>     curMsg.setMessageContext(this);
>
> We can reproduce this issue with the "filesystem" and "consume" provided
> by pubscribe:
>    1. access http://localhost:8080/pubscribe/notifproducer.jsp
>    2. click "Trigger Notification !"
>    3. In the console (System.out), we can get the following stack trace:
> java.lang.NullPointerException
>         at
> org.apache.axis.MessageContext.setCurrentMessage(MessageContext.java:630)
>         at
> org.apache.axis.MessageContext.setMessage(MessageContext.java:648)
>         at
> org.apache.ws.resource.handler.ResourceHandler.handleResponse(ResourceHandler.java:239)
>         at
> org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:210)
>         at
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>         at
> org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>         at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>         at
> org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at
> org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
>         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
>
> Best Regards,
>
> Yang Ziqiang (杨自强)
> IBM China Software Development Lab
> Tel: (86-10) 82782244-2671
> Fax: (86-10) 82782244-2886
> Email: yangziq@cn.ibm.com
> Address: 2/F, Deshi Building, No. 9, East Road, ShangDi, Beijing 100085,
> P.R.China
>
>


--
Davanum Srinivas : http://wso2.com/blogs/