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

2024-03-02

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

https://docs.jboss.org/author/display/JBWS/WS-Security#WS-Security-Authenticationandauthorization 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);要么提供一个正确的部署,用容器模块依赖项替换嵌入式库,要么为当前部署禁用 Web 服务子系统,并向其添加正确的 jboss-deployment-struct.xml 描述符。建议使用前一种方法,因为后一种方法会导致大多数 Web 服务 Java EE 和任何 JBossWS 特定功能被禁用。

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

无法处理部署的阶段 PARSE https://stackoverflow.com/questions/27380360/failed-to-process-phase-parse-of-deployment

Wildfly 上基于 WSDL 的 Web 服务 https://stackoverflow.com/questions/26162595/wsdl-based-webservices-on-wildfly

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


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

如果您使用Maven项目然后添加以下依赖范围“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。

希望它会有所帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐