![](/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.