Jaxb中的Annox插件问题

时间:2013-11-08 12:51:29

标签: java xml ant jaxb annox

我一直在努力解决这个问题。我试图通过外部绑定文件向xjc存根添加注释,但坚持这个错误。我已经抓住了网,但正确的解决方案仍然没有找到我。可能是我想念的傻事。需要一些神圣的嫉妒。

这是我正在使用的绑定文件:

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

这是我一直看到的错误:

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

BTW,我正在使用ant脚本在我的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 个答案:

答案 0 :(得分:0)

问题是你的类路径中缺少一些jar。同样的问题发生在maven项目上,看看他们的解决方案,并尝试将这些类路径添加到您的ANT构建中:

jaxb annox plugin not working