【问题标题】:org.jboss.as.server.deployment.DeploymentUnitProcessingException: Apache CXF library detected in ws endpoint deploymentorg.jboss.as.server.deployment.DeploymentUnitProcessingException:在 ws 端点部署中检测到 Apache CXF 库
【发布时间】:2015-02-21 10:37:01
【问题描述】:

我正在使用 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 特定功能被禁用。

我做了谷歌搜索和一些类似的问题。

Failed to process phase PARSE of deployment

WSDL based webservices on Wildfly

我在哪里可以找到一些有用的答案?

【问题讨论】:

    标签: eclipse web-services cxf wildfly ws-security


    【解决方案1】:

    在使用带有 wildfly8.2 和 wildfly8.1 的 CXF 时,我遇到了同样的问题。 基本上,wildfly 服务器有自己的 CXF jars ,默认情况下会在您启动服务器时加载。

    如果您使用 ma​​ven 项目,则添加以下依赖项,范围为“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 文件中。

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

    如果你把 jar 放到 lib 文件夹中,编写 ant 代码来排除 .war 文件的 jar。

    希望它会有所帮助。

    【讨论】:

      猜你喜欢
      • 2017-10-02
      • 1970-01-01
      • 2021-12-05
      • 2016-10-23
      • 1970-01-01
      • 2012-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多