org.jboss.as.server.deployment.DeploymentUnitProcessingException:在ws端点部署中检测到Apache CXF库 [英] org.jboss.as.server.deployment.DeploymentUnitProcessingException: Apache CXF library detected in ws endpoint deployment

查看:1575
本文介绍了org.jboss.as.server.deployment.DeploymentUnitProcessingException:在ws端点部署中检测到Apache CXF库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

部署是确定的!但问题似乎是日食的客户。我使用eclipse ide制作了一些jsp代码

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,

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

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

所以我将cxf-rt-ws-security-2.7.13.jar复制到/ WEBContent / WEB-INF / lib,那么它会引发这个异常,部署甚至失败。

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.

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

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.

无法处理相位PARSE部署

Wildfly上的基于WSDL的Web服务

哪里可以有一些有用的答案?请告诉我。感谢提前。

Where can I some useful answer? Pls, inform me. Thanks in advance.

推荐答案

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

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.

如果您使用 maven项目,然后添加以下依赖关系,范围为提供

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>

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

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.

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

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

如果将jar放在lib文件夹中写入ant代码以排除.war文件的jar。

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

希望会有所帮助。

这篇关于org.jboss.as.server.deployment.DeploymentUnitProcessingException:在ws端点部署中检测到Apache CXF库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆