在Wildfly部署中使用CXF库,并提供Maven工件

我试图将包含JAX-WS接口的项目部署到wildfly 8.2服务器。 该项目是一场战争。 在该项目中,我想使用拦截器。

import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; public class ReplyToHeaderInInterceptor extends AbstractSoapInterceptor { /*code*/} 

我正在使用带有“提供”标记的Maven,以便不会收到以下错误:

 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. 

看起来像这样:

   org.apache.cxf cxf-rt-frontend-jaxws 3.1.1 provided  

但是,如果我这样做,则无法在运行时找到库:

 Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor 

我已经尝试使用maven通过MANIFEST.MF文件添加依赖项:

   org.apache.maven.plugins maven-war-plugin 2.5  WEB-INF/web.xml backend   org.apache.cxf     

我不知道该怎么办,有什么建议吗?

另一种选择是使用您自己的结构,而不是Wildfly服务器部署中提供的模块(版本)。 这是通过jboss-deployment-structure.xml文件到WEB-INF完成的,内容如下:

       

这将禁用Wildfly中包含的Web服务框架并使用包含war的库(lib jars)

这在相关问题/答案中提到: 如何从Wildfly(Jboss)访问用于ws端点的CXF jar

结果是在WEB-INF文件夹中添加了一个jboss-deployment-structure.xml文件,其中包含以下内容:

            

虽然我以前只用org.apache.cxf尝试过,但我不得不添加org.apache.cxf.impl