java 未找到 Java2WSDL(轴)类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12613628/
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-10-31 09:33:23  来源:igfitidea点击:

Java2WSDL (Axis) Class Not Found

javaweb-servicesaxis

提问by paperclip

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
  • %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.

我将 %AXIS_LIB% 定义为 c:\Axis-1_4\lib。

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

按照教程,我尝试使用 Java2WSDL 来生成 WSDL 文件。

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

但是,我收到 Class Not Found 错误。

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

为什么我不能调用 Java2WSDL?

Thanks!

谢谢!

回答by smooth reggae

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

您仍然需要AXIS_LIB在类路径中使其可用,否则 Java 将无法找到org.apache.axis.wsdl.Java2WSDL;您可以通过设置CLASSPATH%AXIS_LIB%;%CLASSPATH%或添加-cp %AXIS_LIB%到您的命令来执行此操作。