Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSDL2Java Throws Could not find main class: org.apache.axis.wsdl.WSDL2Java

I am trying to create the java files from a remote webservice. I downloaded axis 1.4, copied the lib folder to c:\data\axis\lib which contains of these files:

  • axis.jar
  • axis-ant.jar
  • commons-discovery-0.2.jar
  • commons-logging-1.0.4.jar
  • jaxrpc.jar
  • log4j.properties
  • log4j-1.2.8.jar
  • saaj.jar
  • wsdl4j-1.5.1.jar

I added the c:\data\axis\lib folder to the %AXISCLASSPATH%. Now I am trying to create the java classes using this cmd:

java -cp %AXISCLASSPATH% org.apache.wsdl.WSDL2JAVA http://myurl.com?wsdl

However I keep getting the following error message:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/
WSDL2Java
Caused by: java.lang.ClassNotFoundException: org.apache.axis.wsdl.WSDL2Java
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.apache.axis.wsdl.WSDL2Java.  Program will exit.

Can someone help me to get this working?

like image 934
vikasde Avatar asked Feb 19 '10 19:02

vikasde


2 Answers

Add the jars to the classpath individually if you're using a Java version before 6. If you're using Java 6, see here if you want to use wildcards.

like image 113
Voytek Jarnot Avatar answered Nov 03 '22 12:11

Voytek Jarnot


try

java -cp %AXISCLASSPATH% org.apache.wsdl.WSDL2Java http://myurl.com?wsdl

Class names are case sensitive

like image 32
stjohnroe Avatar answered Nov 03 '22 13:11

stjohnroe