File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Axis Web Service Client : NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis Web Service Client : NullPointerException" Watch "Axis Web Service Client : NullPointerException" New topic

Axis Web Service Client : NullPointerException

Himanshu Jhamb
Ranch Hand

Joined: Aug 01, 2001
Posts: 134

I have written a very simple web service on my local machine. Am using Tomcat w/Apache Axis to implement the same. I coded a very simple *.jws file in the Tomcat webapp directory. The file has two very simple public methods. With Tomcat & Axis, I was able to see the wsdl of the web service on my browser. That said, I started with the client. I generated the stub classes & interfaces (2 each) using the WSDL2Java tool and moved those generated classes in my workspace. Once done, I tried to run my client from the command line (Actually, I am using Eclipse IDE). The client is able to locate the service but throws a NullPointerException on the Call.Invoke method. ( I see this in the Stacktrace). I checked the Apache Axis docs for troubleshooting and found that it might be the Validation library (Crimson, by default) or the fact that the client and server are both on local server. I downloaded Xerces and referenced it in my project. I just do not understand why there is an issue with the client and the server being on the same local host. Does this mean that if the web service is on a remote machine, I wont run into this issue? Please help.


- Himanshu
PS> I am using the first example from the 'Real web services' book and having this issue.

Himanshu Jhamb<br />SCJP2 v1.2 (April 2002)<br />SCJP2 v1.4 (May 2002)
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Can you post the snippet of your error details. Also try to use some tcpip sniffers like Apache SOAPTCPMonitor from Axis or TCP/IP Trace from also, this will tell what messages sent btwn client and server and where exactly the error occurs.
Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134
Hi there,

I am exactly getting the same NPE error. Below is the stack trace. I am just not able to identify the problem. Since it was throwing parse errors, I did give a reference to the xml parsers.

However, I am able to bind to the service but not able to call the webservice method. I have been trying to resolve this for 2 days now. Thanks !

Mei Zhu

Joined: Jun 15, 2005
Posts: 1
You mentioned that you run your client in your workspace. You might have some jar files which contain older versions of some classes which axis uses now. For example, I encounter a similar problem because my workspace contains jaxm.jar(from 2003) which has the same set of classes as saaj.jar which comes with axis. As soon as I removed the jaxm.jar, everything runs fine. I even wrote a utility myself to inspect jar files under a directry and list which classes apear in more than one jar files.
I agree. Here's the link:
subject: Axis Web Service Client : NullPointerException
It's not a secret anymore!