javajaxbxjcjaxb2-basicsjaxws-maven-plugin

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

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

<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. It doesn't matter which one I use, i get the same exception about using in the jaxb bindings file. 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>

Solution

  • You're hitting JAXB-1047 - SCD bindings do not support custom/vendor customization elements.

    There is no workaround but to use XPath binding instead.

    Disclaimer: I'm the author of .