在Wildfly部署中使用CXF库,并提供Maven工件 [英] Use CXF libraries in Wildfly deployment with Maven artifact provided
问题描述
我试图将包含JAX-WS接口的项目部署到wildfly 8.2服务器。该项目是一场战争。
在该项目中,我想使用拦截器。
Im trying to deploy a project containing an JAX-WS Interface to a wildfly 8.2 server. The project is packed as a war. Within that project I would like to use interceptors.
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
public class ReplyToHeaderInInterceptor extends AbstractSoapInterceptor { /*code*/}
我正在使用Maven使用提供标记,以便不会收到以下错误:
I'm using Maven with the "provided" tag, in order to not receiving the following error:
Apache CXF library (cxf-rt-bindings-soap-3.1.1.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled.
看起来像这样:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.1</version>
<scope>provided</scope>
</dependency>
但如果我这样做,则在运行时找不到库:
But if I do so the library cannot be found at runtime:
Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor
我已经尝试使用maven在MANIFEST.MF文件中添加依赖项:
I have already tried adding the dependency via the MANIFEST.MF file using maven:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
<warName>backend</warName>
<archive>
<manifestEntries>
<Dependencies>org.apache.cxf</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
我不知道该怎么办,有什么建议吗?
I don't know what to do, any suggestions?
推荐答案
结果发现添加 jboss-deployment-structure.xml
文件到 WEB-INF
具有以下内容的文件夹就可以了:
It turned out adding a jboss-deployment-structure.xml
file to WEB-INF
folder with the following content did the trick:
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<exclusions>
</exclusions>
<dependencies>
<module name="org.apache.cxf" />
<module name="org.apache.cxf.impl" />
</dependencies>
</deployment>
</jboss-deployment-structure>
尽管我之前尝试过 org.apache.cxf $ c仅限$ c>,我必须添加
org.apache.cxf.impl
Eventhough I tried it before with org.apache.cxf
only,I had to add org.apache.cxf.impl
这篇关于在Wildfly部署中使用CXF库,并提供Maven工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!