【问题标题】:Java web app on JBoss(Wildfly 10.0) not deploying through EclipseJBoss(Wildfly 10.0)上的 Java Web 应用程序未通过 Eclipse 部署
【发布时间】:2016-09-25 00:13:38
【问题描述】:

我使用 Tomcat v8.0 运行我的 Java Web 应用程序,但是我想尝试 JBoss。我通过 Eclipse 添加了 Wildfly 10.0(也通过 Eclipse 下载了运行时)。

服务器启动时出现一些错误。我可以访问 http://localhost:8080 就好了,我会看到 Wildfly 起始页。不过,我无法加载我的网络应用程序。

这是我得到的错误:

15:57:49,657 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."NpCWS.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."NpCWS.war".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment "NpCWS.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYWS0059: Apache CXF library (cxf-2.7.18.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.
    at org.jboss.as.webservices.deployers.WSLibraryFilterProcessor.deploy(WSLibraryFilterProcessor.java:70)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
    ... 5 more

我看到它说它是由Apache CXF 引起的,但我不知道如何让 JBoss 使用我的版本。我知道 JBoss 带有自己的 Apache CXF jar,但我也不知道如何更改我的 beans.xmlweb.xml 以反映更改。

我在网上找到的所有解决方案都是针对 Maven 项目的,但我的只是一个简单的动态 Web 项目。

这是我的beans.xmlweb.xml

beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <!-- HELLO SERVICE -->
    <jaxws:endpoint xmlns:tns="http://ws.cloudlet.org/" id="helloservice"
        implementor="org.cloudlet.ws.HelloServiceImpl" wsdlLocation="wsdl/test/helloserviceimpl.wsdl"
        endpointName="tns:HelloServiceImplPort" serviceName="tns:HelloServiceImplService"
        address="/HelloServiceImplPort">

        <jaxws:features>
            <bean class="org.apache.cxf.feature.LoggingFeature" />
        </jaxws:features>
    </jaxws:endpoint>

    <!-- CALCULATOR SERVICE -->
    <jaxws:endpoint xmlns:tns="http://ws.cloudlet.org/" id="calculatorservice"
        implementor="org.cloudlet.ws.CalculatorServiceImpl" wsdlLocation="wsdl/test/calculatorserviceimpl.wsdl"
        endpointName="tns:CalculatorServiceImplPort" serviceName="tns:CalculatorServiceImplService"
        address="/CalculatorServiceImplPort">

        <jaxws:features>
            <bean class="org.apache.cxf.feature.LoggingFeature" />
        </jaxws:features>
    </jaxws:endpoint>
</beans>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    id="WebApp_ID" version="3.1">

    <display-name>NpCWS</display-name>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <description>Apache CXF Endpoint</description>
        <display-name>cxf</display-name>
        <servlet-name>cxf</servlet-name>
        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>cxf</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>WEB-INF/cxf-beans.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
</web-app>

任何帮助将不胜感激!我真的很想学习如何使用 JBoss。谢谢!

【问题讨论】:

  • 你能解决这个@m.o 吗?

标签: java eclipse jboss cxf wildfly


【解决方案1】:

WildFly 为您生成的日志中有您的答案:

提供一个适当的部署,用容器模块依赖替换嵌入式库,或者禁用当前部署的 webservices 子系统,添加一个适当的 jboss-deployment-structure.xml 描述符。建议使用前一种方法,因为后一种方法会导致大多数 Web 服务 Java EE 和任何 JBossWS 特定功能被禁用。

这意味着您需要提供自己的模块依赖项,以便 WildFly 绕过选择自己的 Apache CXF 版本,而是选择您的。

创建一个自定义模块、一个module.xml 和一个jboss-deployment-structure.xml 来完成此操作。

有关如何执行此操作的更多详细信息,请参见此处:https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

【讨论】:

  • 非常感谢!我能够部署它。
猜你喜欢
  • 2018-09-08
  • 2013-03-16
  • 1970-01-01
  • 2013-04-22
  • 2015-02-19
  • 2013-10-02
  • 1970-01-01
  • 2021-06-30
  • 2013-12-11
相关资源
最近更新 更多