WSDL2Java 抛出找不到主类:org.apache.axis.wsdl.WSDL2Java

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2299009/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 05:50:10  来源:igfitidea点击:

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

javaweb-servicesaxis

提问by vikasde

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\libwhich contains of these files:

我正在尝试从远程网络服务创建 java 文件。我下载了轴 1.4,复制了c:\data\axis\lib包含这些文件的 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
  • 轴文件
  • 轴蚂蚁.jar
  • commons-discovery-0.2.jar
  • commons-logging-1.0.4.jar
  • jaxrpc.jar
  • log4j.properties
  • log4j-1.2.8.jar
  • 文件
  • wsdl4j-1.5.1.jar

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

我将c:\data\axis\lib文件夹添加到%AXISCLASSPATH%. 现在我正在尝试使用这个 cmd 创建 java 类:

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.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?

有人可以帮我解决这个问题吗?

回答by Voytek Jarnot

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

如果您使用的是 Java 6 之前的版本,请将 jar 单独添加到类路径中。如果您使用的是 Java 6,请参阅此处是否要使用通配符。

回答by stjohnroe

try

尝试

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

Class names are case sensitive

类名区分大小写

回答by Chris Coleman

Login as eucalyptis and compile and it will find all of the jars - this took me forever to figure out!

以 eucalyptis 身份登录并编译,它会找到所有的罐子 - 这让我花了很长时间才弄清楚!

回答by user1147181

package structure is wrong. Please use org.apache.axis.wsdl.WSDL2Java

包结构错误。请使用 org.apache.axis.wsdl.WSDL2Java