theo
theo

Reputation: 995

Unsupported binding namespace exception for vendor specific namespace

I have a Vendor.xsd, where the namespace definition is referencing a vendor specific namespace http://vendor.com/xjc-plugins. A snippet is given below:

...
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:common="http://annox.dev.java.net" 
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:vendor="http://vendor.com/xjc-plugins"
elementFormDefault="qualified" 
jaxb:extensionBindingPrefixes="vendor common" 
jaxb:version="2.0"> 
...
xs:complexType name="VendorType">
    <xs:annotation>
        <xs:appinfo>
            <vendor:package>vendor.package</vendor:package>
        </xs:appinfo>
    </xs:annotation>
...

When I try to generate jaxbs by using either xjc from command line or maven-jaxb22-plugin the following exception occurs:

Unsupported binding namespace "http://vendor.com/xjc-plugins". Perhaps you meant "http://annox.dev.java.net"?

The maven plugin I am using is given here:

      <plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb22-plugin</artifactId>
    <version>0.13.1</version>
    <executions>
      <execution>
        <goals>
          <goal>generate</goal>
        </goals>
        <configuration>
          <schemaDirectory>src/main/resources</schemaDirectory>
          <schemaIncludes>
            <include>Vendor.xsd</include>
          </schemaIncludes>
          <generatePackage>com.vendor.model</generatePackage>
          <extension>true</extension>
          <args>
            <arg>-Xannotate</arg>
          </args>
          <plugins>
            <plugin>
              <groupId>org.jvnet.jaxb2_commons</groupId>
              <artifactId>jaxb2-basics-annotate</artifactId>
              <version>1.0.2</version>
            </plugin>
            <plugin>
              <groupId>org.jvnet.jaxb2_commons</groupId>
              <artifactId>jaxb2-basics</artifactId>
              <version>1.11.1</version>
            </plugin>
            <plugin>
              <groupId>org.jvnet.jaxb2_commons</groupId>
              <artifactId>jaxb2-basics-tools</artifactId>
              <version>1.11.1</version>
            </plugin>
          </plugins>
        </configuration>
      </execution>
    </executions>
  </plugin>

Any ideas welcome ?

Upvotes: 2

Views: 1054

Answers (1)

lexicore
lexicore

Reputation: 43671

You do not seem to include your XJC plugin in plugins section of the maven-jaxb2-plugin configuration. Binding namespace must be acknowledged by some plugin. You only include jaxb2-basics but not the plugin which would acknowledge http://vendor.com/xjc-plugins.

Upvotes: 2

Related Questions