o.o
o.o

Reputation: 3751

Java web app on JBoss(Wildfly 10.0) not deploying through Eclipse

I was using Tomcat v8.0 to run my Java web app, however I wanted to try out JBoss. I added Wildfly 10.0 through Eclipse (downloaded runtime through Eclipse as well).

The server starts up with some errors. I can visit http://localhost:8080 just fine and I will see the Wildfly start page. Though, I can't load my web app.

Here's the error I get:

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

I see that it says it is caused by Apache CXF but I can't figure out how to make JBoss use my version of it. I know JBoss comes with its own Apache CXF jars but I also can't figure out how I would change my beans.xml and web.xml to reflect the change.

All the solutions I found online are for Maven projects but mine is just a simple Dynamic Web Project.

Here is my beans.xml and web.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>

Any help would be appreciated! I really want to learn how to use JBoss. Thank you!

Upvotes: 0

Views: 2020

Answers (1)

Sampada
Sampada

Reputation: 2991

Your answer is there in the log WildFly is generating for you:

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.

Meaning you will need to provide your own module dependencies so that WildFly bypasses picking its own version of Apache CXF and instead picks yours.

Create a custom module, a module.xml and a jboss-deployment-structure.xml to accomplish this.

More details on how to do that can be found here: https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

Upvotes: 2

Related Questions