今天启动jboss7时,遇到一个异常,导致启动失败,如下:
12:58:15,661 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."td-3topdesk.ear".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."td-3topdesk.ear".POST_MODULE: Failed to process phase POST_MODULE of deployment "td-3topdesk.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_21]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_21]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.api.core.servlet.WebAppResourceConfig com.sun.jersey.api.core.ClasspathResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.ApplicationAdapter
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:209)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:101)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
于是就网上查了下,终于找到一种解决方法:去掉standalone.xml文件中的以下两项:
<extension module="org.jboss.as.jaxrs"/>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
再次启动,成功!