Jboss 7部署struts war文件

时间:2016-07-12 07:01:31

标签: jboss7.x struts-1

当我尝试在jboss 7 AS服务器中部署war文件时出现以下错误

23:23:07,111 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."testapp.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."testapp.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "testapp.war"
    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.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_95]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_95]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_95]
Caused by: java.lang.RuntimeException: Error getting reflective information for class fr.improve.struts.taglib.layout.LabelledTag with ClassLoader ModuleClassLoader for Module "deployment.testapp.war:main" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
    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
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/struts/util/MessageResources;
    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_95]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2509) [rt.jar:1.7.0_95]
    at java.lang.Class.getDeclaredFields(Class.java:1819) [rt.jar:1.7.0_95]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts.util.MessageResources from [Module "deployment.testapp.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
    ... 15 more

23:23:07,118 INFO  [org.jboss.as.server] (HttpManagementService-threads - 7) JBAS015870: Deploy of deployment "testapp.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testapp.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"testapp.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"testapp.war\""}}
23:23:07,206 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment testapp.war in 87ms
23:23:07,206 INFO  [org.jboss.as.controller] (HttpManagementService-threads - 7) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."testapp.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."testapp.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "testapp.war"

1 个答案:

答案 0 :(得分:0)

当您尝试在jboss7 / wildfly中部署ear / war / jar部署并且尚未指定应用程序需要哪些依赖项时,会发生此问题。

Jboss7 / Wildfly拥有自己的模块类加载器,用于隔离运行到同一java虚拟机中的应用程序和依赖项。 jboss / wildfly中的所有部署都作为模块加载(不仅是modules文件夹中包含的内容,部署文件夹的内容也是模块)。

如果你没有包装&#34; struts&#34; jar应用程序部署文件中,您需要将所需的依赖项部署为模块,并告诉jboss您的应用程序依赖于它。

所以,你至少有五种选择:

  1. 将您的应用程序构建为包含依赖项的Uber-Jar 内部。
  2. 在deployments文件夹中部署您的应用程序和依赖项,并在您的应用程序中添加一个清单条目,告诉jboss 你的申请取决于它。
  3. 在deployments文件夹中部署应用程序和应用程序依赖项(jar),并在您的文件中添加一个jboss部署描述符xml 应用程序告诉jboss你的应用程序依赖它。
  4. 在deployments文件夹中部署应用程序并为依赖项创建模块(如果不存在)并添加清单 在您的申请中输入,告诉jboss您的申请 取决于它。
  5. 在deployments文件夹中部署应用程序并为依赖项创建模块(如果不存在)并使用jboss部署 你的应用程序中的描述符xml告诉jboss你的 应用取决于它。
  6. 欲了解更多信息,请访问: jboss 7 classloader jboss 7 deployment descriptors