当类在JBoss AS7 WAR WEB-INF / classes文件夹中时,NoClassDefFoundError

时间:2011-08-16 19:03:01

标签: java jboss7.x

我正在使用JBoss AS7。尝试部署我的应用程序时出现ClassNotFoundException - 看起来它没有找到JMSException

09:54:53,166 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."myapp-maventest.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."myapp-maventest.war".INSTALL: Failed to process phase INSTALL of deployment "myapp-maventest.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
    at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
    at java.lang.Thread.run(Thread.java:680) [:1.6.0_26]
Caused by: java.lang.RuntimeException: Error getting reflective information for class com.mycompany.myapp.common.jms.servlets.StationLogout
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    at org.jboss.as.ee.component.EEModuleClassDescription$DefaultConfigurator.configure(EEModuleClassDescription.java:144)
    at org.jboss.as.ee.component.EEClassConfigurationProcessor.deploy(EEClassConfigurationProcessor.java:100)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: JMSException
    at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_26]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_26]
    at java.lang.Class.getDeclaredMethods(Class.java:1791) [:1.6.0_26]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: JMSException from [Module "deployment.myapp-maventest.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
    at org.jboss.modules.Conc

JMSException.class不在/ modules / javax / jms中。我在jar文件中有这个类 - javaee-api-6.0.jar。我将这个jar文件复制到/ src / main / webapp / WEB-INF / lib,但我仍然收到这个ClassNotFoundException。

我需要帮助调试。我尝试了一件事 - 我想也许JBoss加载的/ modules / javax模块与我的javaee-api-6.0.jar文件冲突 - 所以我试图用src / main / webapp / WEB-INF / jboss-排除它deployment-structure.xml文件

<jboss-deployment-structure>
  <deployment>
    <exclusions>
        <module name="javax.jms" />
    </exclusions>
  </deployment>
</jboss-deployment-structure>

但我仍然得到相同的NoClassDefFoundError。关于如何解决的任何建议?

1 个答案:

答案 0 :(得分:1)

您是否在jbossas7中启用了JMS模块?默认情况下,未启用standalone.xml。您必须编辑正在使用的standalone.xml,然后它将加载jms和实现(又名Hornetq) )。