我的WebSphere 8.5应用程序有一个包含MDB项目的EAR项目,该项目构建为生成JAR。该JAR有一个类,它引用来自第三个项目的EAR中的辅助JAR中的类。
包含MDB的jar(ASyncEJB.jar)的清单是
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Class-Path: ASync.jar
lib\aopalliance\aopalliance-1.0.jar
lib\asm\asm-3.1.jar
etc (more lib references)
EAR中包含企业项目的清单看起来像
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: abc
Built-By: xyz
Built-Date: September 18 2014
Implementation-Version: Value_not_provided
看起来ASyncEJB.jar清单中的类路径应该允许它从辅助ASync.jar加载类。
The structure of the EAR is
lib
META-INF
ASync.jar
ASyncEJB.jar
带有MANIFEST.MF的META-INF文件夹的application.xml看起来像
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="6" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<display-name>AsyncEnterprise</display-name>
<module id="Module_1381933529290">
<ejb>ASyncEJB.jar</ejb>
</module>
</application>
为什么我会在ASyncEJB.jar中的类调用的ASync.jar中的类上获得java.lang.ClassNotFoundException?
错误是:
[22/09/14 15:10:04:285 EDT] 00000065 SharedEJBRunt I WSVR0057I: EJB jar started: ASyncEJB.jar
[22/09/14 15:10:04:386 EDT] 00000065 BusinessExcep E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "initialize" on bean "BeanId(AsyncEnterprise#ASyncEJB.jar#ejbContext, null)". Exception data: java.lang.NoClassDefFoundError: corporg.core.context.listener.WebContextListener
at corporg.async.beans.ContextInitilizer.initialize(ContextInitilizer.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:232)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:559)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.doLifeCycle(InvocationContextImpl.java:273)
at com.ibm.ejs.container.SingletonBeanO.callTransactionalLifecycleInterceptors(SingletonBeanO.java:273)
at com.ibm.ejs.container.SingletonBeanO.initialize(SingletonBeanO.java:404)
at com.ibm.ejs.container.BeanOFactory.create(BeanOFactory.java:130)
at com.ibm.ejs.container.EJSHome.createNewBeanO(EJSHome.java:869)
at com.ibm.ejs.container.EJSHome.createSingletonBeanO(EJSHome.java:3981)
at com.ibm.ejs.csi.EJBApplicationMetaData.createStartupBeans(EJBApplicationMetaData.java:991)
at com.ibm.ejs.csi.EJBApplicationMetaData.startedModule(EJBApplicationMetaData.java:715)
at com.ibm.ws.runtime.component.EJBContainerImpl.stateChanged(EJBContainerImpl.java:4866)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.stateChanged(ApplicationMgrImpl.java:1120)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectEvent(DeployedApplicationImpl.java:1353)
at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:248)
at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:244)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:642)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: java.lang.ClassNotFoundException: corporg.core.context.listener.WebContextListener
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:688)
at java.lang.ClassLoader.loadClass(ClassLoader.java:667)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
... 31 more