0

您好我正在使用带有 ant xjc 的 JAXB annox 并收到以下错误
C:_Dev\build\abcSupplierDomain.xml:479: java.lang.NoSuchMethodError:

com.sun.codemodel.JAnnotatable.annotations()Ljava/util/Collection;
        at org.jvnet.jaxb2`enter code here`_commons.plugin.annotate.Annotator.annotate(Annotator.java:62)
        at org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin.annotate

有人能告诉我这个错误的原因是什么吗?我已经下载了所有用于执行此操作的 JAXB 2.* jar,因为 jaxb2-basics-annotate-0.6.4 支持 org.jvnet.jaxb2_commons.xjc.XJC2Task。

下面是我的 xjb 文件和 build.xml

构建.xml

<xjc schema="serviceDescription/atlantis/v2/com.abc.e3.ss.lodging.lodginginterface.messages.availsummary.v2.xsd" 
            destdir="${src.gen.dir}" extension="true" removeoldoutput="true"
            binding="build/annoxBindings.xjb">
          <arg value="-Xannotate" />
          <arg value="-episode" />
          <arg value="${src.gen.dir}/LodgingInterface-AvailSummary_v2.episode" />
          <produces dir="${src.gen.dir}/com/abc/e3/ss/lodging/lodginginterface/messages/availsummary/defn/v2" includes="**/*.java" />
             <binding dir="${src.gen.dir}">
                            <include name="BaseTypes.episode"/>
                            <include name="TimeTypes.episode"/>
                            <include name="PlaceTypes.episode"/>
                            <include name="PersonTypes.episode"/>
                            <include name="FinanceTypes.episode"/>
                            <include name="MessageTypes.episode"/>
                            <include name="ErrorTypes.episode"/>
                            <include name="LodgingInterface-CommonTypes_3.episode"/>
                            <include name="LodgingInterface-AvailSummaryTypes_v2.episode"/>
                        </binding>
        </xjc>

我的 xjb 文件

<?xml version="1.0" encoding="UTF-8"?> 
<jaxb:bindings
  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:annox="http://annox.dev.java.net"
  xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
  jaxb:version="2.1"
  jaxb:extensionBindingPrefixes="annox">

  <jaxb:bindings schemaLocation="file:/C:/SubversionProjects/sharedComponents/abcSupplierDomain_Dev/serviceDescription/atlantis/v2/com.expedia.e3.ss.lodging.lodginginterface.messages.availsummary.v2.xsd">
    <jaxb:bindings node="//xs:complexType[@name='AvailSummaryRequestType']">
      <annox:annotate>
        <annox:annotate
           annox:class="javax.xml.bind.annotation.XmlRootElement"
           name="AvailSummaryRequest" />
    </annox:annotate>
    </jaxb:bindings>
  </jaxb:bindings>

</jaxb:bindings>
4

1 回答 1

0

jaxb2-basics-annotate 0.6.4 需要 JAXB 2.2.x,看起来您使用的是旧版本的 JAXB 2。

于 2013-01-17T08:45:11.160 回答