SOAP client application exception
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 wsr开发者_运维问答unclient.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?
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
精彩评论