對於進一步的研究人員,我想分享一些關於如何從JBoss 6中刪除所有舊的JAXB和CXF的額外步驟。其中1個,並添加新的版本(它增強伊夫·馬丁答案):
被刪除:
common/deploy/jbossws-console.war
server/<configuration>/deploy/jbossws-console-activator-jboss-beans.xml
server/<configuration>/deployers/jbossws.deployer/
server/<configuration>/deployers/jbossws-jaxrpc.deployer/
client/cxf-*.jar
client/jaxws-*.jar
client/jaxb-impl.jar
client/jaxb-xjc.jar
client/wstx-lgpl.jar
client/jbossws-*.jar
client/stax-api.jar
client/activation.jar
lib/wstx-lgpl.jar
lib/jaxb-impl.jar
lib/jaxb-xjc.jar
common/lib/jboss-jaxb-api_2.2_spec.jar
common/lib/jboss-jaxws-api_2.2_spec.jar
common/lib/jboss-jaxrpc-api_1.1_spec.jar
common/lib/cxf-*.jar
common/lib/jaxws-*.jar
common/lib/jbossws-*.jar (except common/lib/jbossws-spi.jar)
lib/endorsed/activation.jar
lib/endorsed/jboss-jaxb-api_2.2_spec.jar
lib/endorsed/jbossws-cxf-factories.jar
lib/endorsed/jboss-jaxws-api_2.2_spec.jar
lib/endorsed/stax-api.jar
從配置文件在: 服務器//部署器/交換機-的jboss-豆。 XML
刪除以下行:
<entry>
<key>javax.xml.ws.WebServiceContext</key>
<value><inject bean="org.jboss.switchboard.WebServiceContextResourceProvider"/></value>
</entry>
<inject bean="org.jboss.switchboard.WebServiceRefResourceProvider"/>
如果你想JAXB + CXF升級到2.6.3,加入這些庫:
lib/jaxb-xjc-2.1.13.jar
lib/endorsed/activation-1.1.1.jar
lib/endorsed/jaxb-api-2.2.6.jar
lib/endorsed/jaxws-api-2.2.6.jar
lib/endorsed/stax2-api-3.1.1.jar
lib/endorsed/saaj-api-1.3.4.jar
lib/endorsed/cxf-api-2.6.3.jar
common/lib/cxf-api-2.6.3.jar
如果你有Java 6中的項目,新的JAXB將與這一個從JRE推斷,所以我們必須認可新版本。以下是如何做到這一點的行家:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<maxmem>512m</maxmem>
<compilerArguments>
<endorseddirs>${project.build.directory}/endorsed</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkMode>once</forkMode>
<argLine>-Djava.endorsed.dirs=${project.build.directory}/endorsed</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jax.version}</version>
</artifactItem>
<artifactItem>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>${jax.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<configuration>
<fork>once</fork>
<additionalJvmArgs>-Djava.endorsed.dirs=${project.build.directory}/endorsed</additionalJvmArgs>
<!-- rest of the normal codegen configuration options -->
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jax.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jax.version}</version>
</dependency>
</dependencies>
</plugin>
在你的IDE,你必須告訴它使用新的JAXB庫進行編譯。在IDEA的情況下,你可以在這裏:
IDEA -> Settings -> Compiler -> Java Compiler
in "Additional command line parameters" add:
-endorseddirs /<your_absolut_path_to_project>/target/endorsed/
我剛剛得到了我的項目需要。我正在調查 – 2012-03-14 15:08:20
一定要發佈你的進度,我很困擾這個問題。 – 2012-03-14 16:16:12
事實上,我遇到了麻煩,因爲JBossWS-CXF在我的應用程序中發現了Spring,並且需要它在JBoss ClassLoader中。然後,我的客戶端通過JavaSE從WSDL生成wsimport未能加載其類......因爲我僅將WS用作客戶端,所以我尋找相同的選項。 – 2012-03-14 20:33:42