简体   繁体   English

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

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

I am using Eclipse Juno and WildFly 8.2 and try to deploy soap web services with ws-security. 我正在使用Eclipse Juno和WildFly 8.2,并尝试通过ws-security部署soap Web服务。 This is my ref site. 这是我的参考网站。

https://docs.jboss.org/author/display/JBWS/WS-Security#WS-Security-Authenticationandauthorization 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. 但是问题似乎是Eclipse的客户。 I made some jsp codes with eclipse ide 我用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);

Above codes throw simple exception, 上面的代码抛出简单的异常,

An error occurred at line: 12 in the generated java file : Only a type can be imported. 在生成的java文件中的第12行发生错误:只能导入类型。 org.apache.cxf.ws.security.SecurityConstants resolves to a package org.apache.cxf.ws.security.SecurityConstants解析为一个包

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. 因此,我将cxf-rt-ws-security-2.7.13.jar复制到/ WEBContent / WEB-INF / lib,然后抛出此异常,甚至部署失败。

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; 由以下原因引起:org.jboss.as.server.deployment.DeploymentUnitProcessingException:JBAS015599:在ws端点部署中检测到Apache CXF库(cxf-rt-ws-security-2.7.13.jar); 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. 提供适当的部署,用容器模块依赖项替换嵌入式库,或者为当前部署禁用webservices子系统,并向其添加适当的jboss-deployment-structure.xml描述符。 The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled. 建议使用前一种方法,因为后一种方法会导致大多数Web服务Java EE和任何JBossWS特定功能被禁用。

I did googling and some issues like these. 我确实进行了谷歌搜索,并且遇到了类似这样的问题。

Failed to process phase PARSE of deployment 无法处理部署阶段的PARSE

WSDL based webservices on Wildfly Wildfly上基于WSDL的Web服务

Where can I some useful answer? 在哪里可以找到有用的答案?

I had the same issue while working with the CXF with wildfly8.2 and wildfly8.1. 在使用带有wildfly8.2和wildfly8.1的CXF时,我遇到了相同的问题。 Basically the wildfly server has its own CXF jars , which are by default loaded when you start the server. 基本上,wildfly服务器具有自己的CXF jar,在启动服务器时默认情况下会加载它们。

If you use the maven project then add the below dependancy with scope " provided " 如果您使用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>

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. 因此它不会在开发工作区中给您任何错误,jar将被添加到eclipse的类路径中,但不会将cxf jar添加到您的.war文件中。

If it is Ant project add the jar to class path as external jars but dont put the jars to lib folder. 如果是Ant项目,则将jar作为外部jar添加到类路径,但不要将jar放入lib文件夹。

If you put the jar to lib folder write the ant code to exclude the jar for the .war file. 如果将jar放在lib文件夹中,请编写ant代码以排除.war文件的jar。

Hope it will help. 希望它会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM