![](/img/trans.png)
[英]ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1)
[英]org.jboss.as.server.deployment.DeploymentUnitProcessingException: Apache CXF library detected in ws endpoint deployment
我正在使用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特定功能被禁用。
我确实进行了谷歌搜索,并且遇到了类似这样的问题。
在哪里可以找到有用的答案?
在使用带有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。
希望它会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.