> Iam getting java.lang.NoClassDefFoundError:
> javax/servlet/ServletContext exception while invoking the service
[quoted text clipped - 25 lines]
> Usually the cause for such exception is missing servlet.jar.
> Can anybody point out what would be problem ?
I don't quite understand what your client is trying to do, but something
is very fishy here. If the client has any reason to access a
ServletContext then it needs to be properly deployed in a servlet
container, and the container should be providing the servlet API to it.
I can't tell whether your client needs to run inside a servlet
container and you're trying to run it some other way, or whether it just
is incorrect in attempting to access a ServletContext; if I had to
guess, though, I would guess the former.

Signature
John Bollinger
jobollin@indiana.edu
Major - 28 Nov 2005 06:22 GMT
The client is plain java class. Even this is very surprising to me also
that why it is demanding for a ServletContext. This is very apparent
with the code below -
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class dynamicAxisClient {
public static void main(String[] args)
{
try {
String endpoint
="http://localhost:9080/TestWS/services/TestService?WSDL";
//ServiceFactory serviceFactory = (ServiceFactory)
ServiceFactory.newInstance();
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint));
call.setOperationName(new QName("greetGuest"));
String[] param = new String[1];
param[0]= "Major";
String ret = (String) call.invoke(args );
System.out.println("The Return Xml is " + ret + "\n");
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
Thanks for replying
John C. Bollinger - 29 Nov 2005 03:15 GMT
> The client is plain java class. Even this is very surprising to me also
> that why it is demanding for a ServletContext. This is very apparent
> with the code below -
[code elided]
You may have discovered an Axis bug, though I am not sufficiently expert
with Axis to be sure one way or another. I don't see any special reason
why a web services client should need to have the servlet API available
to it, though. A quick perusal of the Axis docs did not illuminate me
in this regard. I suggest you check the bug database and consider
submitting a bug report if this problem has not already been reported.

Signature
John Bollinger
jobollin@indiana.edu