newone2011
asked on
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/wsdl/WSDL2
I keep getting this error even though I have all the classes. I am trying to run the command:
java -classpath "wsdl2java
.jar;wsdl4j.jar;axis.jar;a xis-ant.ja r;saaj.jar ;junit-4.0 .jar;jaxrp c.jar;log4 j-1.
2.8.jar;commons-logging.ja r;commons- discovery. jar" org.apache.wsdl.WSDL2Java cls
Test.wsdlException in thread "main" java.lang.NoClassDefFoundE rror: org/apache/wsdl/WSDL2
Java
Caused by: java.lang.ClassNotFoundExc eption: org.apache.wsdl.WSDL2Java
at java.net.URLClassLoader$1. run(Unknow n Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(Un known Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at sun.misc.Launcher$AppClass Loader.loa dClass(Unk nown Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at java.lang.ClassLoader.load ClassInter nal(Unknow n Source)
Could not find the main class: org.apache.wsdl.WSDL2Java. Program will exit.
Also here are the files in my dir:
<DIR> .
<DIR> ..
385,010 axis-ant.jar
1,235,721 axis.jar
25,187 Test.wsdl
<DIR> com
71,442 commons-discovery.jar
31,605 commons-logging.jar
35,759 jaxrpc.jar
105,601 junit-4.0.jar
352,668 log4j-1.2.8.jar
<DIR> META-INF
<DIR> org
18,501 saaj.jar
<DIR> wsdl2java
5,140 WSDL2Java.class
7,803 wsdl2java.jar
113,853 wsdl4j.jar
java -classpath "wsdl2java
.jar;wsdl4j.jar;axis.jar;a
2.8.jar;commons-logging.ja
Test.wsdlException in thread "main" java.lang.NoClassDefFoundE
Java
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
at java.lang.ClassLoader.load
Could not find the main class: org.apache.wsdl.WSDL2Java.
Also here are the files in my dir:
<DIR> .
<DIR> ..
385,010 axis-ant.jar
1,235,721 axis.jar
25,187 Test.wsdl
<DIR> com
71,442 commons-discovery.jar
31,605 commons-logging.jar
35,759 jaxrpc.jar
105,601 junit-4.0.jar
352,668 log4j-1.2.8.jar
<DIR> META-INF
<DIR> org
18,501 saaj.jar
<DIR> wsdl2java
5,140 WSDL2Java.class
7,803 wsdl2java.jar
113,853 wsdl4j.jar
in waht directory are you issiuning this command?it looks like all your jars are in diffenernt folders but you don;'t mention those folders in your command line in classpath string
put all your jars in one folder and in the same folder issue the above command
when you say
jav -cp "wsdl2java.jar;commons-log ging.jar" ..
it assumes that these jars are right in this folder where you excute your command
when you say
jav -cp "wsdl2java.jar;commons-log
it assumes that these jars are right in this folder where you excute your command
You either need to put them all in one folder or specify the folders, like:
java -cp "wsdl2java\wsdl2java.jar;w sdl2java\w sdl4j.jar; com\common s-discover y.jar;..."
assuming that you are in the folder one level higher than wsdl2java and com folders
java -cp "wsdl2java\wsdl2java.jar;w
assuming that you are in the folder one level higher than wsdl2java and com folders
ASKER
for_yan my jars are all in the same folder from where I am running this command. That's why I am surprised as I to why I am still getting this error.
But you DIR printout shows them in different folders ? Is this old location ?
So you have them all in one folder and you are trying to execute command in the same folder?
It also shows some strange end of lines inside your command - are they really there?
So you have them all in one folder and you are trying to execute command in the same folder?
It also shows some strange end of lines inside your command - are they really there?
ASKER
I am removed all dirs to avoid any confusion. Here is the listing:
02/01/2012 02:53 PM <DIR> .
02/01/2012 02:53 PM <DIR> ..
08/22/2009 11:17 AM 385,010 axis-ant.jar
08/22/2009 11:17 AM 1,235,721 axis.jar
02/01/2012 01:33 PM 25,187 Test.wsdl
08/22/2009 11:17 AM 71,442 commons-discovery.jar
08/22/2009 11:17 AM 31,605 commons-logging.jar
08/22/2009 11:17 AM 35,759 jaxrpc.jar
02/15/2009 11:34 PM 105,601 junit-4.0.jar
08/22/2009 11:17 AM 352,668 log4j-1.2.8.jar
08/22/2009 11:17 AM 18,501 saaj.jar
06/13/2009 09:19 AM 5,140 WSDL2Java.class
08/22/2009 11:17 AM 7,803 wsdl2java.jar
08/22/2009 11:17 AM 113,853 wsdl4j.jar
I run it again: (cleaned up the char)
java -classpath "wsdl2java
.jar;wsdl4j.jar;axis.jar;a xis-ant.ja r;saaj.jar ;junit-4.0 .jar;jaxrp c.jar;log4 j-1.
2.8.jar;commons-logging.ja r;commons- discovery. jar" org.apache.wsdl.WSDL2Java
Test.wsdl
I get the same error:
Exception in thread "main" java.lang.NoClassDefFoundE rror: org/apache/wsdl/WSDL2
Java
Caused by: java.lang.ClassNotFoundExc eption: org.apache.wsdl.WSDL2Java
at java.net.URLClassLoader$1. run(Unknow n Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(Un known Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at sun.misc.Launcher$AppClass Loader.loa dClass(Unk nown Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at java.lang.ClassLoader.load ClassInter nal(Unknow n Source)
Could not find the main class: org.apache.wsdl.WSDL2Java. Program will exit.
02/01/2012 02:53 PM <DIR> .
02/01/2012 02:53 PM <DIR> ..
08/22/2009 11:17 AM 385,010 axis-ant.jar
08/22/2009 11:17 AM 1,235,721 axis.jar
02/01/2012 01:33 PM 25,187 Test.wsdl
08/22/2009 11:17 AM 71,442 commons-discovery.jar
08/22/2009 11:17 AM 31,605 commons-logging.jar
08/22/2009 11:17 AM 35,759 jaxrpc.jar
02/15/2009 11:34 PM 105,601 junit-4.0.jar
08/22/2009 11:17 AM 352,668 log4j-1.2.8.jar
08/22/2009 11:17 AM 18,501 saaj.jar
06/13/2009 09:19 AM 5,140 WSDL2Java.class
08/22/2009 11:17 AM 7,803 wsdl2java.jar
08/22/2009 11:17 AM 113,853 wsdl4j.jar
I run it again: (cleaned up the char)
java -classpath "wsdl2java
.jar;wsdl4j.jar;axis.jar;a
2.8.jar;commons-logging.ja
Test.wsdl
I get the same error:
Exception in thread "main" java.lang.NoClassDefFoundE
Java
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
at java.lang.ClassLoader.load
Could not find the main class: org.apache.wsdl.WSDL2Java.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check your wsdl2java.jar - it should contain org.apache.axis.wsdl.WSDL2 Java.class
in the appropriate folderr
You can just make a copy to wsdl2java.zip and inspect this zip file with winzip
Once it has this file in tha appropriate folder - it should find it
in the appropriate folderr
You can just make a copy to wsdl2java.zip and inspect this zip file with winzip
Once it has this file in tha appropriate folder - it should find it
You know when I go to findJar.com and type
org.apache.wsdl.WSDL2Java
I find nothing, but when i type
org.apache.axis.wsdl.WSDL2 Java
then I find a lot
Maybe you need
org.apache.axis.wsdl.WSDL2 Java
after all
org.apache.wsdl.WSDL2Java
I find nothing, but when i type
org.apache.axis.wsdl.WSDL2
then I find a lot
Maybe you need
org.apache.axis.wsdl.WSDL2
after all
With something of this complexity, you'd find it a lot easier to run/build with Ant
ASKER
This is resolved. The problem was here:
java -classpath "axis.jar;
axis-ant.jar;wsdl2java.jar ;wsdl4j.ja r;saaj.jar ;junit-4.0 .jar;jaxrp c.jar;log4 j-1.
2.8.jar;commons-logging.ja r;commons- discovery. jar" org.apache.axis.wsdl.WSDL2 Jav
a Test.wsdl
IT was org.apache.axis.wsdl and not org.apache.wsdl It was part of axis.jar.
Meanwhile could you also let me know on the ant solution using may be eclipse. I will award the points.
java -classpath "axis.jar;
axis-ant.jar;wsdl2java.jar
2.8.jar;commons-logging.ja
a Test.wsdl
IT was org.apache.axis.wsdl and not org.apache.wsdl It was part of axis.jar.
Meanwhile could you also let me know on the ant solution using may be eclipse. I will award the points.
the ant solution using may be eclipse
afaicr Eclipse doesn't mix too well with Ant. I use Ant 'bare'
ASKER
Not complete