You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Patrick Verkaik <pa...@cs.vu.nl> on 2004/01/13 17:53:50 UTC

exception handling

Hello, I have a question that I hope someone can help me with..


I am deploying a class that contains methods that can throw exceptions.
Whenever an exception is thrown, my client receives a '(500)Internal
Server Error'. The following appears in the tomcat log file:



2004-01-13 17:31:23 StandardWrapperValve[rpcrouter]: Servlet.service() for
servlet rpcrouter threw exception
javax.servlet.ServletException: Error building response envelope:
java.lang.NullPointerException
        at
org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:418)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

(etc)



I have deployed using the following descriptor:

<!-- generated by vu.globe.svcs.gloap.apache.GenGloapDeployDescriptor -->
<isd:service xmlns:isd='http://xml.apache.org/xml-soap/deployment'
             id='http://gloap.gdn.apps.gaia.vu'>
  <isd:provider type='java'
                scope='Session'
                methods='bind getFileTraceInfo'>
    <isd:java class='vu.gaia.apps.gdn.gloap.PackageGloapSession' static='false'/>
  </isd:provider>

  <isd:faultListener>org.apache.soap.server.DOMFaultListener
  </isd:faultListener>
  <isd:mappings>
    <isd:map
       encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
       xmlns:x='http://gdn.apps.gaia.vu' qname='x:getFileTraceInfoResults'
       javaType='vu.gaia.apps.gdn.getFileTraceInfoResults'
       java2XMLClassName='org.apache.soap.encoding.soapenc.BeanSerializer'
       xml2JavaClassName='org.apache.soap.encoding.soapenc.BeanSerializer'
     />
  </isd:mappings>
</isd:service>

On the server side I am using Apache Soap 2.3.1, Tomcat 5.0.16, Xerces
1.4.4. My client is using Axis 1.1.

I have tried throwing RemoteException, a subclass of RemoteException, and
'Exception'. The same happens in each case. The deployed class works fine
as long as no exceptions are thrown.

	Help would be much appreciated..

	Patrick

Re: exception handling

Posted by Scott Nichol <sn...@scottnichol.com>.
The NPE is a bug that was fixed after 2.3.1.

At issue is the following from the DeploymentDescriptor:

  <isd:faultListener>org.apache.soap.server.DOMFaultListener
  </isd:faultListener>

The character data for the faultListener is the name of a Java class.  Because white space is significant in the data, the class name in this case has a trailing newline and spaces.  The JVM cannot, of course, load the class.  Unfortunately, Apache SOAP still tries to use the null reference it gets when trying to instantiate the class, and you get an NPE.

All you need to do to get things to work is remove the whitespace:

  <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Patrick Verkaik" <pa...@cs.vu.nl>
To: <so...@ws.apache.org>
Cc: "Patrick Verkaik" <pa...@cs.vu.nl>
Sent: Tuesday, January 13, 2004 11:53 AM
Subject: exception handling


> 
> Hello, I have a question that I hope someone can help me with..
> 
> 
> I am deploying a class that contains methods that can throw exceptions.
> Whenever an exception is thrown, my client receives a '(500)Internal
> Server Error'. The following appears in the tomcat log file:
> 
> 
> 
> 2004-01-13 17:31:23 StandardWrapperValve[rpcrouter]: Servlet.service() for
> servlet rpcrouter threw exception
> javax.servlet.ServletException: Error building response envelope:
> java.lang.NullPointerException
>         at
> org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:418)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> 
> (etc)
> 
> 
> 
> I have deployed using the following descriptor:
> 
> <!-- generated by vu.globe.svcs.gloap.apache.GenGloapDeployDescriptor -->
> <isd:service xmlns:isd='http://xml.apache.org/xml-soap/deployment'
>              id='http://gloap.gdn.apps.gaia.vu'>
>   <isd:provider type='java'
>                 scope='Session'
>                 methods='bind getFileTraceInfo'>
>     <isd:java class='vu.gaia.apps.gdn.gloap.PackageGloapSession' static='false'/>
>   </isd:provider>
> 
>   <isd:faultListener>org.apache.soap.server.DOMFaultListener
>   </isd:faultListener>
>   <isd:mappings>
>     <isd:map
>        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
>        xmlns:x='http://gdn.apps.gaia.vu' qname='x:getFileTraceInfoResults'
>        javaType='vu.gaia.apps.gdn.getFileTraceInfoResults'
>        java2XMLClassName='org.apache.soap.encoding.soapenc.BeanSerializer'
>        xml2JavaClassName='org.apache.soap.encoding.soapenc.BeanSerializer'
>      />
>   </isd:mappings>
> </isd:service>
> 
> On the server side I am using Apache Soap 2.3.1, Tomcat 5.0.16, Xerces
> 1.4.4. My client is using Axis 1.1.
> 
> I have tried throwing RemoteException, a subclass of RemoteException, and
> 'Exception'. The same happens in each case. The deployed class works fine
> as long as no exceptions are thrown.
> 
> Help would be much appreciated..
> 
> Patrick
>