Issue with Annox plugin in Jaxb

2.3k views Asked by At

I been struggling with this issue for sometime now. I trying to add annotations to xjc stubs via an external bindings file but stuck with this error. I have scrounged the net but the correct solution still eludes me. May its something silly i am missing. Require some divine enligthenment.

here is the bindings file i am using:

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    jaxb:extensionBindingPrefixes="xjc hj annox"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:annox="http://annox.java.net"
    xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
    xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
    <jaxb:globalBindings localScoping="toplevel" />
    <jaxb:bindings schemaLocation="abc.xsd"
        node="//xs:complexType[@name='pqrRequest']">
        <annox:annotate>
            <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
                name="pqrRequest" />
        </annox:annotate>
    </jaxb:bindings>
</jaxb:bindings>

This is the error i keep seeing:

[ERROR] Unsupported binding namespace "http://annox.java.net". Perhaps you meant "http://java.sun.com/xml/ns/jaxb/xjc"?

BTW, i am using ant script to create the stubs in my build.xml:

<target name="generateStubs" depends="cleanStubs">
        <java classname="com.sun.tools.internal.xjc.XJCFacade">
               <arg value="-d"/>
               <arg value="${src.dir}"/>
                <arg value="-p" />
                <arg value="stubs"/>
                <arg value="../xsd/abc.xsd" />
                <arg value="-b" />
                <arg value="../xsd/bindings.xml" />
                <arg value="-extension" />
        </java>
    </target>
1

There are 1 answers

0
kavai77 On

The problem is that there are some jars missing from your classpath. The same issue happened on a maven project, have a look at their resolution and try to add those classpath to your ANT build:

jaxb annox plugin not working