简体   繁体   English

当 class 在 JBoss AS7 WAR WEB-INF/classes 文件夹中时出现 NoClassDefFoundError

[英]NoClassDefFoundError when class is in JBoss AS7 WAR WEB-INF/classes folder

I'm using JBoss AS7.我正在使用 JBoss AS7。 I get a ClassNotFoundException when attempting to deploy my app - looks like it's not finding JMSException尝试部署我的应用程序时收到 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 is not in /modules/javax/jms. JMSException.class 不在 /modules/javax/jms 中。 I have this class in a jar file - javaee-api-6.0.jar.我在 jar 文件中有这个 class - javaee-api-6.0.jar。 I copied this jar file to /src/main/webapp/WEB-INF/lib, but I'm still receiving this ClassNotFoundException.我将此 jar 文件复制到 /src/main/webapp/WEB-INF/lib,但我仍然收到此 ClassNotFoundException。

I need help debugging.我需要帮助调试。 One thing I tried - I thought maybe the /modules/javax module JBoss was loading was conflicting with my javaee-api-6.0.jar file - so I tried to exclude it with a src/main/webapp/WEB-INF/jboss-deployment-structure.xml file我尝试过的一件事-我想可能正在加载的 /modules/javax 模块 JBoss 与我的 javaee-api-6.0.jar 文件冲突-所以我尝试使用 src/main/webapp/WEB-INF/jboss- 排除它部署结构.xml 文件

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

but I still get the same NoClassDefFoundError.但我仍然得到相同的 NoClassDefFoundError。 Any advice on how to fix?关于如何修复的任何建议?

Have you enabled the module of JMS in the jbossas7?By default in the standalone.xml isn't enabled.You have to edit the standalone.xml you are using and then it will load the jms and the implementation(aka Hornetq).您是否在 jbossas7 中启用了 JMS 模块?默认情况下,standalone.xml 未启用。您必须编辑您正在使用的 Standalone.xml,然后它将加载 jms 和实现(又名 Hornetq)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM