简体   繁体   中英

Could not find WSDL2Java class

I am trying to generate webservice from an existing WSDL file. In AXIS2 home page I found the method to that.

java org.apache.axis2.wsdl.WSDL2Java -uri file:///C:/apps/axis2/samples/zSample/Axis2UserGuide.wsdl -p org.apache.axis2.axis2userguide -d adb -s -wv 1.1 -ss -sd -ssi

But when I execute this command in my terminal it gives the following error.

 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/wsdl/WSDL2Java
    Caused by: java.lang.ClassNotFoundException: org.apache.axis2.wsdl.WSDL2Java
        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:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Could not find the main class: org.apache.axis2.wsdl.WSDL2Java.  Program will exit.

That class is in axi2-codegewn jar,

Then I tried to define the classpath using several methods. There are many dependencies (many jars to refer) so that I cant define the jars one by one seperately. What is the correct way to define the classpath to execute above command ? I want to include all jars in the libs folder at once.

You have to add all the dependency jar files in your classpath. Use an IDE and add external libraries to your classpath. If your are doing it manually add all the jar files in your classpath.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM