0

I wrote a client application that consumes a SOAP web service. I developed the code using Eclips and it works fine there. Now, I'm trying to run the same application from the terminal by using wsrunclient.sh so it gets the input but after that it crashes and gives this exception:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/client/Service
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at Weather.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.axis.client.Service
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

But the axis.jar which is version 1.4 is already in the classpath! So, please any thoughts why this error come up?

5
  • can you post the contents of your wsrunclient.sh file ?
    – Santosh
    Sep 22, 2011 at 11:35
  • I hope you do mean the axis.jar is on the application's classpath, not only on the Eclipse classpath.
    – Thomas
    Sep 22, 2011 at 11:38
  • just a question, you added axis.jar in Eclipse, but have you placed the same jar in PATH correctly? or is it remains in the Project Path only?
    – Kris
    Sep 22, 2011 at 11:39
  • No, the axis.jar is in the classpath of the application.
    – thinkBig
    Sep 22, 2011 at 12:03
  • Solved!!! Actually I was trying to run using this command: wsrunclient.sh -classpath output myService So, I thought since the jar files are already within the output folder they will be included with the classpath but that was wrong! I have to name all the jar files separately with the class path, so the correct way to do it is: wsrunclient.sh -classpath output:output/net/webservicex/axis.jar:output/net/webservicex/log4j-1.2.8.jar:output/net/webservicex/commons-discovery-0.2.jar myService
    – thinkBig
    Sep 22, 2011 at 15:10

1 Answer 1

2

Solved!!! Actually I was trying to run using this command:

wsrunclient.sh -classpath output myService

So, I thought since the jar files are already within the output folder they will be included with the classpath but that was wrong! I have to name all the jar files separately with the class path, so the correct way to do it is:

wsrunclient.sh -classpath output:output/net/webservicex/axis.jar:output/net/webservicex/log4j-1.2.8.jar:output/net/webservicex/commons-discovery-0.2.jar  myService

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.