WSDL2Java 抛出无法找到主类:org.apache.axis.wsdl.WSDL2Java
我正在尝试从远程 Web 服务创建 java 文件。我下载了 axis 1.4,将 lib 文件夹复制到 c:\data\axis\lib
其中包含以下文件:
- 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
我将 c:\data\axis\lib
文件夹添加到 <代码>%AXISCLASSPATH%。现在我尝试使用此cmd创建java类:
java -cp %AXISCLASSPATH% org.apache.wsdl.WSDL2JAVA http://myurl.com?wsdl
但是我不断收到以下错误消息:
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.
有人可以帮助我让它工作吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用的是 6 之前的 Java 版本,请将 jar 单独添加到类路径中。如果您使用的是 Java 6,请参阅 此处 如果您想使用通配符。
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.
尝试
类名区分大小写
try
Class names are case sensitive
以 eucalyptis 身份登录并编译,它将找到所有的罐子 - 这花了我很长时间才弄清楚!
Login as eucalyptis and compile and it will find all of the jars - this took me forever to figure out!
包结构错误。请使用 org.apache.axis.wsdl.WSDL2Java
package structure is wrong. Please use org.apache.axis.wsdl.WSDL2Java