maven 集成cxf-codegen-plugin报 JAXB 2.0 API jar is being loaded!

15 views
Skip to first unread message

george

unread,
Mar 18, 2008, 9:56:30 PM3/18/08
to cxf-zh
maven 的配置如下:
<properties>
<spring.version>2.5.1</spring.version>
<struts2.version>2.0.11</struts2.version>
<project.name>cc-demo</project.name>
<package>com.chinacache.demo</package>
<tomcat.dir>D:/ProgramFiles/jakarta-tomcat-5.0.28</tomcat.dir>
<cxf.version>2.0.4-incubator</cxf.version>
</properties>

<build>
<plugins>

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.0.4-incubator</version>


<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>
${basedir}/target/generated/src/main/java
</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>
${basedir}/src/main/wsdl/myService.wsdl
</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>


</plugin>


</plugins>
</build>

执行mvn命令后的结果如下
$ mvn eclipse:eclipse
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'eclipse'.
[INFO]
------------------------------------------------------------------------
[INFO] Building cc-wsclient-demo
[INFO] task-segment: [eclipse:eclipse]
[INFO]
------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
[INFO] [cxf-codegen:wsdl2java {execution: generate-sources}]
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] JAXB 2.0 API jar is being loaded (from jar:file:/D:/apache-
maven-2.0.8/repositories/javax/xml/bind/jaxb-api/2.0/jaxb-api-2.0.jar!/
javax/xml/bind/annotation/XmlSchema.class
but this RI (from jar:file:/D:/apache-maven-2.0.8/repositories/com/
sun/xml/bind/jaxb-impl/2.0.5/jaxb-impl-2.0.5.jar!/com/sun/xml/bind/v2/
model/impl/ModelBuilder.class) requires
XB 2.1 API jar.

即使手动的指定
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
</dependency>
依然报错。。。

willem

unread,
Mar 19, 2008, 10:05:40 PM3/19/08
to cxf-zh
你可以使用mvn -X 来打开debug信息,看看是否有JAXB API Jar的冲突。
还有就是你使用的是JDK1.6 吗,这个也有可能会造成JAXB的冲突。

姜宁 (Willem)
--------------------------------
http://willem.bokeland.com

george

unread,
Mar 20, 2008, 4:17:06 AM3/20/08
to cxf-zh
修改 cxf-parent\2.0.4-incubator\cxf-parent-2.0.4.incubator.pom
<jaxb.version>2.0</jaxb.version>
<jaxb.impl.version>2.0.5</jaxb.impl.version>
--------------------------------------------->替换为
<jaxb.impl.version>2.0.2</jaxb.impl.version>
<jaxb.xjc.version>2.0</jaxb.xjc.version>
<jaxws.version>2.0</jaxws.version>
<jetty.version>6.1.6</jetty.version>
<saaj.version>1.3</saaj.version>
<saaj.impl.version>1.3</saaj.impl.version>
<spring.version>2.0.6</spring.version>
<spring.mock>spring-mock</spring.mock>
<wsdl4j.version>1.6.1</wsdl4j.version>
<derby.version>10.2.2.0</derby.version>
<activemq.version>4.1.1</activemq.version>
<geronimo.version>1.1</geronimo.version>
<rhino.version>1.6R5</rhino.version>
<jdom.version>1.0</jdom.version>
<xmlbeans.version>2.2.0</xmlbeans.version>


就ok了,JDK1.5



On Mar 20, 10:05 am, willem <willem.ji...@gmail.com> wrote:
> 你可以使用mvn -X 来打开debug信息,看看是否有JAXB API Jar的冲突。
> 还有就是你使用的是JDK1.6 吗,这个也有可能会造成JAXB的冲突。
>
> 姜宁 (Willem)
> --------------------------------http://willem.bokeland.com

george

unread,
Mar 20, 2008, 5:17:39 AM3/20/08
to cxf-zh
修改cxf-parent-2.0.4.incubator.pom 里面包的依赖关系
<jaxb.impl.version>2.0.5</jaxb.impl.version>
--------------------------------------------->替换为
<jaxb.impl.version>2.0.2</jaxb.impl.version>
jaxb-impl-2.0.5.jar 。。。。requires JXB 2.1 API jar.

如果替换jxb2.1 也会有错误。。。

willem

unread,
Mar 20, 2008, 5:29:50 AM3/20/08
to cxf-zh
CXF 2.0.4 lib里也是使用jaxb-impl-2.0.5.jar的,而且我觉得jaxb-impl-2.0.5.jar 也不会使用到
JAXB2.1 API的。

要不把你Maven目录下面的jaxb-impl-2.0.5.jar 删除掉,还是使用<jaxb.impl.version>2.0.5</
jaxb.impl.version> 再跑一遍看看。

姜宁 (Willem)
--------------------------------
http://willem.bokeland.com

george

unread,
Mar 20, 2008, 5:55:33 AM3/20/08
to cxf-zh
恩,重新下载一个就好了。。
Thank U~

On Mar 20, 5:29 pm, willem <willem.ji...@gmail.com> wrote:
> CXF 2.0.4 lib里也是使用jaxb-impl-2.0.5.jar的,而且我觉得jaxb-impl-2.0.5.jar 也不会使用到
> JAXB2.1 API的。
>
> 要不把你Maven目录下面的jaxb-impl-2.0.5.jar 删除掉,还是使用<jaxb.impl.version>2.0.5</
> jaxb.impl.version> 再跑一遍看看。
>
> 姜宁 (Willem)
> --------------------------------http://willem.bokeland.com
Reply all
Reply to author
Forward
0 new messages