org.jboss.as.server.deployment.DeploymentUnitProcessingException:在ws端点部署中检测到Apache CXF库

问题描述 投票:4回答:1

我正在使用Eclipse Juno和WildFly 8.2并尝试使用ws-security部署soap web服务。这是我的参考站点。

https://docs.jboss.org/author/display/JBWS/WS-Security#WS-Security-Authenticationandauthorization

部署还可以!但问题似乎是Eclipse的客户端。我用eclipse ide制作了一些jsp代码

<%@ page import="javax.xml.ws.BindingProvider"%>

<%@ page import="javax.xml.namespace.QName"%>
<%@ page import="java.net.URL"%>
<%@ page import="javax.xml.ws.Service"%>

<%@ page import="org.apache.cxf.ws.security.SecurityConstants"%> 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>WildFly SOAP Security test</title>
</head>
<body>
<% 
String SERVICE_URL = "http://localhost:8080/SOAPSecureWeb/HelloWorld";

try {
 QName serviceName = new QName("http://soap.aaa.com/", "HelloWorldService");

URL wsdlURL;
 wsdlURL = new URL(SERVICE_URL + "?wsdl");
 Service service = Service.create(wsdlURL, serviceName);
 IHelloWorld port = (IHelloWorld) service.getPort(IHelloWorld.class);

以上代码抛出简单的异常,

生成的java文件中的行:12处发生错误:只能导入类型。 org.apache.cxf.ws.security.SecurityConstants解析为一个包

所以我将cxf-rt-ws-security-2.7.13.jar复制到/ WEBContent / WEB-INF / lib,然后它抛出了这个异常,部署甚至失败了。

引起:org.jboss.as.server.deployment.DeploymentUnitProcessingException:JBAS015599:在ws端点部署中检测到Apache CXF库(cxf-rt-ws-security-2.7.13.jar);或者提供适当的部署,用嵌入式库替换容器模块依赖性,或者为当前部署禁用webservices子系统,为其添加适当的jboss-deployment-structure.xml描述符。建议使用前一种方法,因为后一种方法会导致大多数Web服务Java EE和任何JBossWS特定功能被禁用。

我做谷歌搜索和一些像这样的问题。

Failed to process phase PARSE of deployment

WSDL based webservices on Wildfly

我在哪里可以找到有用的答案?

eclipse web-services cxf wildfly ws-security
1个回答
1
投票

使用wildfly8.2和wildfly8.1时,我在使用CXF时遇到了同样的问题。基本上,wildfly服务器有自己的CXF jar,默认情况下在启动服务器时加载。

如果您使用maven项目,则添加以下依赖项,范围为“已提供”

<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>

所以它不会在你的开发工作区中给你任何错误,jar会被添加到eclipse的类路径中,但它不会将cxf jar添加到你的.war文件中。

如果是Ant项目,将jar添加到类路径作为外部jar,但不要将jar放到lib文件夹中。

如果你把jar放到lib文件夹中写下ant代码来排除.war文件的jar。

希望它会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.