简体   繁体   English

Java:使用“ANT”和“AXIS2 1.8.0”从 WSDL 生成代码

[英]Java: Generating Code from WSDL with "ANT" and "AXIS2 1.8.0"

I am trying to generate Java-Code with ant and axis2 1.8.0 from a wsdl(windows 10), but every time i get the following exception:我正在尝试从 wsdl(windows 10) 生成带有 ant 和axis2 1.8.0 的 Java 代码,但每次我都会收到以下异常:

[java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: XMLBeans binding extension not in classpath

[java]     at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:163)
[java]     at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:54)     
[java]     at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)     
[java] Caused by: java.lang.RuntimeException: XMLBeans binding extension not in classpath     
[java]     at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:90)     
[java]     at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:116)     
[java]     ... 2 more     
[java] Java Result: 1

I've even followed the official instructions from apache and installed XMLBeans: https://xmlbeans.apache.org/documentation/conInstallGuide.html but it still does not work.我什至按照 apache 的官方说明安装了 XMLBeans: https : //xmlbeans.apache.org/documentation/conInstallGuide.html但它仍然不起作用。 Someone had the same issues and can help me out.有人有同样的问题,可以帮助我。

By the way: When i use axis2 1.7.9 it works fine.顺便说一句:当我使用axis2 1.7.9 时,它工作正常。

Same here and same error.在这里一样,同样的错误。 I am trying to get Axis2 1.8.0 to generate Xmlbeans using Xmlbeans 5.0.2 (current latest version) which I am using elsewhere in my project already.我正在尝试让 Axis2 1.8.0 使用 Xmlbeans 5.0.2(当前最新版本)生成 Xmlbeans,我已经在我的项目的其他地方使用了它。 I can see Axis2 generating code with the adb method rather than xmlbeans, but it doesn't seem to generate the xxxDocument classes that my existing code needs and which was generated with the 1.6.3 version of Axis2 previously.我可以看到 Axis2 使用 adb 方法而不是 xmlbeans 生成代码,但它似乎没有生成我现有代码需要的 xxxDocument 类,该类以前是用 1.6.3 版本的 Axis2 生成的。

Per https://axis.apache.org/axis2/java/core/release-notes/1.8.0.html :每个https://axis.apache.org/axis2/java/core/release-notes/1.8.0.html

axis2-xmlbeans has been split into axis2-xmlbeans and axis2-xmlbeans-codegen axis2-xmlbeans 已拆分为axis2-xmlbeans 和axis2-xmlbeans-codegen

I faced a similar issue (java.lang.RuntimeException: XMLBeans binding extension not in classpath) and solved it by adding the following to my maven dependencies, as managed by apache ivy:我遇到了类似的问题(java.lang.RuntimeException:XMLBeans binding extension not in classpath)并通过将以下内容添加到我的 maven 依赖项中来解决它,由 apache ivy 管理:

<dependency org="org.apache.axis2" name="axis2-xmlbeans-codegen" rev="1.8.0" transitive="false" conf="one-jar-lib->default;sources"/>
<dependency org="com.google.googlejavaformat" name="google-java-format" rev="1.13.0" transitive="false" conf="one-jar-lib->default;sources"/>

(In my case, I had to explicitly bring in googlejavaformat since I had transitive dependencies disabled. If you have them enabled, you may not need that line) (就我而言,由于禁用了传递依赖项,因此我必须明确引入 googlejavaformat。如果启用了它们,则可能不需要该行)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM