2014-10-02 122 views
0

我想创建一个简单的基于WSDL的webservice,使用Apache CXF在Wildfly上部署。我尝试了标准的web.xml,CXF-servlet.xml中的配置与WSDL文件,但服务器给了我下面的错误Wildfly上基于WSDL的web服务

Apache CXF library (cxf-api-2.7.3.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

我使用Maven我的构建和部署过程。在进一步阅读时,我意识到Wildfly使用JBossWS堆栈,并且不鼓励基于Spring的CXF配置。我也应该使用wsdl2java或wsprovide/wsconsume? 任何人都可以请指点我如何设置一个简单的项目来创建一个WSDL第一个Web服务,并部署在蜻蜓或指向我的工作示例。

感谢您的帮助,谢谢。

+0

wildfly利用CXF的web服务。不要将它与您的部署捆绑在一起。由于您使用的是maven,所以将范围设置为提供 – maress 2014-10-02 14:23:36

+0

我试过了,它现在给出了以下错误:java.lang.ClassNotFoundException:[Module“deployment.SimpleJaxWSExample.war:org.apache.cxf.transport.servlet.CXFServlet:main “来自Service Module Loader] – 2014-10-02 15:18:26

+0

你在使用什么IDE?我很轻易地用Netbeans来做这件事。 – Namphibian 2014-10-02 22:40:42

回答

1

上述消息的原因恰恰是,WildFly的webservices子系统发现了部署中的Apache CXF库。这不是如何使用Web服务的JavaEE应用程序将被提供并部署在像WildFly这样的JavaEE容器上,这基本上是因为容器负责提供WS引擎功能。特别是,当涉及到WildFly时,Apache CXF在内部使用,因此通过在其部署中添加一些cxf库,用户可能最终陷入复杂的类加载问题,他可能无法轻松解决。 无论如何,消息说明了必须完成的事情:(JBoss)模块依赖关系必须在部署中定义。这可以在部署MANIFEST.MF中轻松完成;一些文档在https://docs.jboss.org/author/display/JBWS/JBoss+Modules(但你可以谷歌的JBoss模块,并找到许多信息)。

一般来说,我真的建议阅读https://docs.jboss.org/author/display/JBWS/Apache+CXF+integration#ApacheCXFintegration-BuildingWSapplicationstheJBossway的文档,它详细解释了JBossWS与Apache CXF的集成,并指出了正确的打包应用。

0

添加所有的依赖关系所提供的范围,作为wildfly有它自己的CXF罐子。 wildfly不需要cxf jar来执行ws。只有您需要IDE的cxf jar才能编译该项目。

<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-rt-frontend-jaxws</artifactId> 
    <version>${cxf.version}</version> 
    <scope>provided</scope> 
</dependency> 
<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-rt-transports-http</artifactId> 
    <version>${cxf.version}</version> 
    <scope>provided</scope> 
</dependency> 
    <!-- Jetty is needed if you're are not using the CXFServlet --> 
<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-rt-transports-http-jetty</artifactId> 
    <version>${cxf.version}</version> 
    <scope>provided</scope> 
</dependency> 

,你可以找到答案here