[英]JAXB2 Basics simplify plugin throws “Cannot find the declaration of element 'simplify:property'” exception
I'm trying to use the jaxb2 basics "simplify" plugin but I'm always receiving the following exception... 我正在尝试使用jaxb2基础“简化”插件,但我总是收到以下异常...
[INFO] --- jaxws-maven-plugin:2.2:wsimport (default) @ dsmlv2-jaxws ---
[INFO] Processing: file:/C:/Users/fryera/Documents/GIT_DEV/cyberavenue/virgin-checkin-webapp-workspace/dsmlv2-web-services/dsmlv2-jaxws/src/main/resources/META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl
[INFO] jaxws:wsimport args: [-keep, -s, C:\Users\fryera\Documents\GIT_DEV\cyberavenue\virgin-checkin-webapp-workspace\dsmlv2-web-services\dsmlv2-jaxws\target\generated-sources\wsimport, -encoding, UTF-8, -extension, -Xnocompile, -httpproxy:@empproxy.8080, -wsdllocation, /META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl, -B-Xsimplify, -B-Xsetters, -B-Xequals, -B-XhashCode, -B-XtoString, -B-Xfluent-api, -b, C:\Users\fryera\Documents\GIT_DEV\cyberavenue\virgin-checkin-webapp-workspace\dsmlv2-web-services\dsmlv2-jaxws\src\main\resources\META-INF\wsdl\dsml\v2\jaxb-bindings.xml, -b, C:\Users\fryera\Documents\GIT_DEV\cyberavenue\virgin-checkin-webapp-workspace\dsmlv2-web-services\dsmlv2-jaxws\src\main\resources\META-INF\wsdl\dsml\v2\jaxws-bindings.xml, file:/C:/Users/fryera/Documents/GIT_DEV/cyberavenue/virgin-checkin-webapp-workspace/dsmlv2-web-services/dsmlv2-jaxws/src/main/resources/META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl]
parsing WSDL...
[ERROR] cvc-elt.1: Cannot find the declaration of element 'simplify:property'.
line 17 of file:/C:/Users/fryera/Documents/GIT_DEV/cyberavenue/virgin-checkin-webapp-workspace/dsmlv2-web-services/dsmlv2-jaxws/src/main/resources/META-INF/wsdl/dsml/v2/jaxb-bindings.xml
I have a jaxb bindings.xml file that looks like this... 我有一个看起来像这样的jaxb bindings.xml文件...
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify" jaxb:extensionBindingPrefixes="xjc simplify" jaxb:version="2.1">
<jaxb:bindings>
<jaxb:globalBindings typesafeEnumMaxMembers="2000">
<xjc:simple />
<xjc:serializable uid="456" />
</jaxb:globalBindings>
</jaxb:bindings>
<jaxb:bindings scd="x-schema::tns" xmlns:tns="urn:oasis:names:tc:DSML:2:0:core">
<jaxb:schemaBindings>
<jaxb:package name="oasis.dsml.v2_0.model" />
</jaxb:schemaBindings>
<jaxb:bindings scd="~tns:BatchRequest">
<simplify:property name="fooOrBar">
<simplify:as-element-property />
</simplify:property>
</jaxb:bindings>
</jaxb:bindings>
</bindings>
In my pom, i'm trying to compile my WSDL using cxf-codegen-plugin and the jaxws-maven-plugin. 在我的pom中,我尝试使用cxf-codegen-plugin和jaxws-maven-plugin编译我的WSDL。 It doesn't matter which one I use, i get the same exception about using in the jaxb bindings file. 我使用哪一个都没关系,我在jaxb绑定文件中也得到了相同的例外。 The plugin is configured as follows... 该插件的配置如下...
<!-- WSIMPORT USING JAXWS-MAVEN-PLUGIN -->
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${jaxb2-basics.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-fluent-api</artifactId>
<version>${jaxb2-fluent-api.version}</version>
</dependency>
</dependencies>
<configuration>
<extension>true</extension>
<bindingDirectory>src/main/resources/META-INF/wsdl/dsml/v2</bindingDirectory>
<wsdlDirectory>src/main/resources/META-INF/wsdl/dsml/v2</wsdlDirectory>
<wsdlLocation>/META-INF/wsdl/dsml/v2/dsmlQueryService.wsdl</wsdlLocation>
<xjcArgs>
<xjcArg>-Xsimplify</xjcArg>
<xjcArg>-Xsetters</xjcArg>
<xjcArg>-Xequals</xjcArg>
<xjcArg>-XhashCode</xjcArg>
<xjcArg>-XtoString</xjcArg>
<xjcArg>-Xfluent-api</xjcArg>
</xjcArgs>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>dsmlQueryService.wsdl</wsdlFile>
</wsdlFiles>
</configuration>
</execution>
</executions>
</plugin>
You're hitting JAXB-1047 - SCD bindings do not support custom/vendor customization elements . 您遇到了JAXB-1047-SCD绑定不支持自定义/供应商自定义元素 。
There is no workaround but to use XPath binding instead. 没有解决方法,只能使用XPath绑定。
Disclaimer: I'm the author of jaxb2-basics . 免责声明:我是jaxb2-basics的作者。
Usually you need plugins
node under configuration
to let xjc
able to load plugin. 通常,您需要configuration
下的plugins
节点,以使xjc
能够加载插件。
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${jaxb2-basics.version}</version>
</plugin>
</plugins>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.