java 如何使用 Axis 1.0 运行 WSDL2Java?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14463135/
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
How do I run WSDL2Java with Axis 1.0?
提问by RoboJ1M
Our clients are using Axis 1.0 to build a client to our WCF based SOAP services.
我们的客户正在使用 Axis 1.0 为我们基于 WCF 的 SOAP 服务构建一个客户端。
It's not working for them and I want to run the WSDL2Java client locally on my machine so I can experiment.
它对他们不起作用,我想在我的机器上本地运行 WSDL2Java 客户端,以便我可以进行试验。
I already have the JDK installed on my machine, java
works from the command line.
我已经在我的机器上安装了 JDK,java
可以从命令行运行。
Reading the installation guide for Axis 1.0, and using the -cp switch, I get the following:
阅读 Axis 1.0 的安装指南,并使用 -cp 开关,我得到以下信息:
java -cp E:\Temp\Axis\xml-axis-10\lib org.apache.axis.wsdl.WSDL2Java
(that path contains all the jar files)
(该路径包含所有 jar 文件)
And get the following:
并得到以下内容:
Error: Could not find or load main class org.apache.axis.wsdl.WSDL2Java
Anybody know what I'm doing wrong?
有人知道我做错了什么吗?
UPDATE1:
更新1:
I've tried setting the user CLASSPATH to:
我试过将用户 CLASSPATH 设置为:
C:\Program Files\Java\jdk1.7.0_09\lib;E:\Temp\Axis\xml-axis-10\lib
No dice, same error.
没有骰子,同样的错误。
UPDATE2:
更新2:
If I try this command line, I get something different, it now appear to be loading the class:
如果我尝试这个命令行,我会得到一些不同的东西,它现在似乎正在加载类:
E:\Temp>java -cp E:\Temp\Axis\xml-axis-10\lib\axis.jar org.apache.axis.wsdl.WSDL2Java
Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory
at org.apache.axis.components.logger.LogFactory.class$(LogFactory.java:68)
at org.apache.axis.components.logger.LogFactory.run(LogFactory.java:84)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:80)
at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:72)
at org.apache.axis.i18n.ProjectResourceBundle.<clinit>(ProjectResourceBundle.java:92)
at org.apache.axis.i18n.MessagesConstants.<clinit>(MessagesConstants.java:71)
at org.apache.axis.utils.Messages.<clinit>(Messages.java:81)
at org.apache.axis.wsdl.WSDL2Java.<clinit>(WSDL2Java.java:106)
E:\Temp>
采纳答案by Adam K.
If you only provide folders in your classpath, the jar files will not be loaded. You should use jar name (as in your UPDATE2) or wildcards (have a look hereand here).
如果您只在类路径中提供文件夹,则不会加载 jar 文件。您应该使用 jar 名称(如在您的 UPDATE2 中)或通配符(查看此处和此处)。
As for your problem with missing LogFactory - you should add to your classpath a proper jar (eg. commons-logging.jar, try http://www.findjar.com).
至于您缺少 LogFactory 的问题 - 您应该在类路径中添加一个适当的 jar(例如,commons-logging.jar,请尝试http://www.findjar.com)。
回答by Harry
Try this: java -cp %CD%\* org.apache.axis.wsdl.WSDL2Java
试试这个: java -cp %CD%\* org.apache.axis.wsdl.WSDL2Java
The jar for logging is already in the lib directory. The above command should work if you are in the lib directory.
用于日志记录的 jar 已经在 lib 目录中。如果您在 lib 目录中,上述命令应该可以工作。