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 Rich Catlett <ri...@more.net> on 2001/10/13 00:22:55 UTC

trouble with soap

Ive run into a problem lately with SOAP that I had to delve into the 
code a little to fix, and even then rather than fixing it I just made 
sure that the code that caused the error to occur didn't run.  I wanted 
to see if anyone else had had this problem, because it seems severe 
enough that it should already have been discovered and fixed.

The problem occurs in the MessageRouterServlet after the service has 
finished running.  The problem happens if an exception occured during 
the execution of the service, when the MessageRouterServlet is trying to 
notify fault listeners that a fault occured.  The problem is that a 
NullPointerException was returned to the SOAP client rather than the 
actual exception that the soap service threw, making debugging of the 
service very difficult.  

below is a very detailed description of exactly where the problem 
occured.  Also I have the latest cvs of soap from maybe  a week and a 
half ago, and I am running tomcat4.

The NullPointerException is thrown when on line 354 of the 
MessageRouterServlet it trys to notify the fault listeners.  I delved 
deeper, the line above ,353, calls buildFaultRouter from the 
deploymentdescriptor for the service, and that in buildFaultRouter in 
the dd on line 323 the it trys to load a class from the SOAPContext.  In 
the SOAPContext is where the actual problem occurs because it trys to 
get the class forName of the faultListener configured for at this point 
a ClassNotFoundException is thrown it can't find the class for 
DOMFaultListener.  I put in some debugging and discovered that the 
classloader it is trying to get the class from is the webappclassloader, 
but for some reason it does not include the WEB-INF/lib directory of the 
webapp.  I got around this by simply not trying to get the 
Class.forName, and simply creating a new instance of the Listener in the 
deploymentdescriptor, but then I ran into another problem.   The 
SoapFaultRouter is created fine, an instance of a FaultRouter (a 
DomFaultRouter) is added to it's list of faultRouters to notify.  Then 
when notifyListeners  is called on the FaultRouter it si supposed to 
notify all listeners in the list that is stored in the FaultRouter.  I 
check the list just before  notifyListeners runs it's for loop to notify 
all of the listeners in it's list and the list exists and contains an 
instance of a FaultListener, when the for loop runs the list is empty 
and when it trys to access the list it throws the NullPointerException.

If anyone has had this problem or has any ideas why I might be seeing 
this error please let me know.  

Rich Catlett