org.jboss.as.server.deployment.DeploymentUnitProcessingException: Apache CXF library detected in ws endpoint deployment

喜欢而已 提交于 2020-01-14 13:06:31

问题


I am using Eclipse Juno and WildFly 8.2 and try to deploy soap web services with ws-security. This is my ref site.

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

Deployment is ok! But the problem seems to be the client of Eclipse. I made some jsp codes with eclipse ide

<%@ 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);

Above codes throw simple exception,

An error occurred at line: 12 in the generated java file : Only a type can be imported. org.apache.cxf.ws.security.SecurityConstants resolves to a package

So I copied cxf-rt-ws-security-2.7.13.jar to /WEBContent/WEB-INF/lib, then it throws this exception and deployment was even failed.

Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS015599: Apache CXF library (cxf-rt-ws-security-2.7.13.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.

I did googling and some issues like these.

Failed to process phase PARSE of deployment

WSDL based webservices on Wildfly

Where can I some useful answer?


回答1:


I had the same issue while working with the CXF with wildfly8.2 and wildfly8.1. Basically the wildfly server has its own CXF jars , which are by default loaded when you start the server.

If you use the maven project then add the below dependancy with scope "provided"

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

so it will not give you any error in your development workspace,jar will be added to class path of eclipse, but it will not add the cxf jar to your .war file.

If it is Ant project add the jar to class path as external jars but dont put the jars to lib folder.

If you put the jar to lib folder write the ant code to exclude the jar for the .war file.

Hope it will help.



来源:https://stackoverflow.com/questions/28644774/org-jboss-as-server-deployment-deploymentunitprocessingexception-apache-cxf-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!