3

我正在尝试使用 WSDL2Java 生成 Java 类。我运行最简单的示例并得到错误。

$ jar tvf XmlSchema-1.4.7.jar | grep org/apache/ws/commons/schema/XmlSchema.class
 14803 Wed Sep 22 17:28:44 CEST 2010 org/apache/ws/commons/schema/XmlSchema.class
$ ./bin/wsdl2java.sh -classpath $(echo lib/*.jar | tr ' ' ';') -uri HelloWorld.wsdl
 Using AXIS2_HOME: /C/Documents and Settings/ixos/axis2-1.6.2
 Using JAVA_HOME:  /C/Program Files/Java/jdk1.7.0_07/
Retrieving document at 'samples/wsdl/Axis2SampleDocLit.wsdl'.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema
        at org.apache.axis2.description.WSDLToAxisServiceBuilder.<init>(WSDLToAxisServiceBuilder.java:103)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.<init>(WSDL11ToAxisServiceBuilder.java:226)
        at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.<init>(WSDL11ToAllAxisServicesBuilder.java:63)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:166)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.XmlSchema
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        ... 6 more

图书馆在路上,现在我被困住了,不知道下一步该做什么。谷歌一点帮助都没有……

类路径

lib/XmlSchema-1.4.7.jar;lib/activation-1.1.jar;lib/antlr-2.7.7.jar;lib/apache-mime4j-core-0.7.2.jar;lib/axiom-api-1.2.13.jar;lib/axiom-dom-1.2.13.jar;lib/axiom-
impl-1.2.13.jar;lib/axis2-adb-1.6.2.jar;lib/axis2-adb-codegen-1.6.2.jar;lib/axis2-ant-plugin-1.6.2.jar;lib/axis2-clustering-1.6.2.jar;lib/axis2-codegen-1.6.2.ja
r;lib/axis2-corba-1.6.2.jar;lib/axis2-fastinfoset-1.6.2.jar;lib/axis2-java2wsdl-1.6.2.jar;lib/axis2-jaxbri-1.6.2.jar;lib/axis2-jaxws-1.6.2.jar;lib/axis2-jibx-1.
6.2.jar;lib/axis2-json-1.6.2.jar;lib/axis2-kernel-1.6.2.jar;lib/axis2-metadata-1.6.2.jar;lib/axis2-mtompolicy-1.6.2.jar;lib/axis2-saaj-1.6.2.jar;lib/axis2-soapm
onitor-servlet-1.6.2.jar;lib/axis2-spring-1.6.2.jar;lib/axis2-transport-http-1.6.2.jar;lib/axis2-transport-local-1.6.2.jar;lib/axis2-xmlbeans-1.6.2.jar;lib/bcel
-5.1.jar;lib/commons-cli-1.2.jar;lib/commons-codec-1.3.jar;lib/commons-fileupload-1.2.jar;lib/commons-httpclient-3.1.jar;lib/commons-io-1.4.jar;lib/commons-logg
ing-1.1.1.jar;lib/geronimo-annotation_1.0_spec-1.1.jar;lib/geronimo-jaxws_2.2_spec-1.0.jar;lib/geronimo-jta_1.1_spec-1.1.jar;lib/geronimo-saaj_1.3_spec-1.0.1.ja
r;lib/geronimo-stax-api_1.0_spec-1.0.1.jar;lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar;lib/httpcore-4.0.jar;lib/jalopy-1.5rc3.jar;lib/jaxb-api-2.1.jar;lib/jaxb-
impl-2.1.7.jar;lib/jaxb-xjc-2.1.7.jar;lib/jaxen-1.1.1.jar;lib/jaxws-tools-2.1.3.jar;lib/jettison-1.0-RC2.jar;lib/jibx-bind-1.2.jar;lib/jibx-run-1.2.jar;lib/jsr3
11-api-1.0.jar;lib/juli-6.0.16.jar;lib/log4j-1.2.15.jar;lib/mail-1.4.jar;lib/mex-1.6.2-impl.jar;lib/neethi-3.0.2.jar;lib/regexp-1.2.jar;lib/tribes-6.0.16.jar;li
b/woden-api-1.0M9.jar;lib/woden-impl-commons-1.0M9.jar;lib/woden-impl-dom-1.0M9.jar;lib/wsdl4j-1.6.2.jar;lib/wstx-asl-3.2.9.jar;lib/xalan-2.7.0.jar;lib/xml-reso
lver-1.2.jar;lib/xmlbeans-2.3.0.jar
4

1 回答 1

0

问题出在您的 jdk (1.7) 上:axis2 无法与之相处。下载jdk 1.6库并在你的eclipse中链接,然后重试。

于 2012-09-27T11:00:22.593 回答