2
votes

I have added the following to System Variables

  • %AXIS_LIB%\axis.jar
  • %AXIS_LIB%\commons-discovery.jar
  • %AXIS_LIB%\commons-logging.jar
  • %AXIS_LIB%\jaxrpc.jar
  • %AXIS_LIB%\saaj.jar
  • %AXIS_LIB%\log4j-1.2.8.jar
  • %AXIS_LIB%\xml-apis.jar
  • %AXIS_LIB%\xercesImpl.jar

I have %AXIS_LIB% defined as c:\Axis-1_4\lib.

Following the tutorial, I tried to use Java2WSDL to produce the WSDL file.

% java org.apache.axis.wsdl.Java2WSDL -o wp.wsdl
    -l"http://localhost:8080/axis/services/WidgetPrice"
    -n  "urn:Example6" -p"samples.userguide.example6" "urn:Example6"
    samples.userguide.example6.WidgetPrice

However, I am getting a Class Not Found error.

C:\axis-1_4\samples\userguide\example6>java org.apache.axis.
wsdl.Java2WSDL -o wp.wsdl -l "http://localhost:8080/axis/services/WidgetPrice" -
n "urn:Example6" -p "samples.userguide.example6" "urn:Example6" samples.userguid
e.example6.WidgetPrice
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/
Java2WSDL
Caused by: java.lang.ClassNotFoundException: org.apache.axis.wsdl.Java2WSDL
        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.Java2WSDL.  Program will exi
t.

Why am I not able to invoke Java2WSDL?

Thanks!

1
From my understanding , Was all required jars in ClassPath? can use the above command as java -cp and the remaining required ? - gks
I added the -CP command with the Classpath variable. Now it is giving me a different error. Something like commmons-logging class not found. What's weird is that I have added the commons-logging.jar into the classpath. - paperclip
I think so u havent added jars on to your classpath ,please set the jars class path exactly, the cause may be for NoClassDefFoundError is here please verify it, Set all required to the CLASSPATH environment variable and use it execution of time as %CLASSPATH% same it will work fine. - gks

1 Answers

2
votes

You still need to make AXIS_LIB available in the class path otherwise Java will not be able to find org.apache.axis.wsdl.Java2WSDL; You can do this either by setting CLASSPATH to %AXIS_LIB%;%CLASSPATH% or by adding -cp %AXIS_LIB% to your command.