问题
I am trying to deploy my struts based web application on Wildfly 9.0.1.Final.
I am deploying as an .ear file that contains .war/.jar(EJB) files.
But it gives me an error during deployment.
Error Stacktrace:
Failed to define class AuditMDB in Module "deployment.webapp.ear.EJB.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link AuditMDB (Module "deployment.webapp.ear.EJB.jar:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:560)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
at org.jboss.as.ejb3.deployment.processors.dd.DeploymentDescriptorMethodProcessor.handleSessionBean(DeploymentDescriptorMethodProcessor.java:118)
at org.jboss.as.ejb3.deployment.processors.dd.DeploymentDescriptorMethodProcessor.deploy(DeploymentDescriptorMethodProcessor.java:73)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
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:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: javax/jms/MessageListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432)
... 19 more
Caused by: java.lang.ClassNotFoundException: javax.jms.MessageListener from [Module "deployment.webapp.ear.EJB.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 23 more
Please help
回答1:
You have to make sure your datasource is defined. In your standalone-full.xml you need to include the definition, something like:
<datasource jndi-name="java:datasources/WEBFDMS" pool-name="WEBFDMS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
"java:datasources/WEBFDMS" might have to be "java:jboss/datasources/WEBFDMS"
Of course, this datasource definition will simply create an in-memory datasource. In order to connect to a running database (mysql, oracle, etc) you will have to configure it differently.
来源:https://stackoverflow.com/questions/32479487/wildfly-9-0-1-final-ear-deployment-failed