【发布时间】: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.xml 和 web.xml 以反映更改。
我在网上找到的所有解决方案都是针对 Maven 项目的,但我的只是一个简单的动态 Web 项目。
这是我的beans.xml 和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>
任何帮助将不胜感激!我真的很想学习如何使用 JBoss。谢谢!
【问题讨论】:
-
你能解决这个@m.o 吗?
标签: java eclipse jboss cxf wildfly