我正在使用 JBoss 4.2.3.GA 并部署一个使用 Hibernate 4.1.5.SP1 的 JAR 应用程序。在我的 JAR 中,我有一个 Quartz 作业,配置如下......
@MessageDriven(activationConfig = {@ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0 40 12 * * ?")})
@ResourceAdapter("quartz-ra.rar")
@Depends({
"jboss.ejb:service=EJBTimerService"})
public class UpdateOrgsJob implements Job {
我认为 JBoss 在一个单独的类加载器中加载 Quartz,而不是在我的 JAR 类被引用的地方,因为,即使它在我的 JAR 文件中,我也会收到错误“java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException”。如何让我的 JAR 类对 Quartz 可见?
下面是完整的堆栈跟踪...
javax.ejb.EJBTransactionRolledbackException: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException^M
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)^M
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)^M
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)^M
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)^M
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)^M
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)^M
at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:249)^M
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)^M
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)^M
at $Proxy90.execute(Unknown Source)^M
at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:57)^M
at org.quartz.core.JobRunShell.run(JobRunShell.java:203)^M
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)^M
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException^M
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)^M
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)^M
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)^M
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)^M
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)^M
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)^M
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)^M
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)^M
... 11 more^M
Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException^M
at java.lang.Class.getDeclaredConstructors0(Native Method)^M
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)^M
at java.lang.Class.getConstructor0(Class.java:2699)^M
at java.lang.Class.newInstance0(Class.java:326)^M
at java.lang.Class.newInstance(Class.java:308)^M
at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:375)^M
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:245)^M
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)^M
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)^M
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)^M
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)^M
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)^M
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)^M
at org.mainco.subco.orgsclient.service.AbstractTransactionService.startOperation(AbstractTransactionService.java:27)^M
at org.mainco.subco.orgsclient.service.OrganizationServiceImpl.saveOrganization(OrganizationServiceImpl.java:87)^M
at org.mainco.subco.orgsclient.service.OrganizationServiceImpl.getEODBOrganizations(OrganizationServiceImpl.java:221)^M
at org.mainco.subco.orgsclient.service.OrganizationServiceImpl.saveOrgsFromWebService(OrganizationServiceImpl.java:183)^M
at org.mainco.subco.orgsclient.quartz.UpdateOrgsJob.execute(UpdateOrgsJob.java:55)^M
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)^M
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)^M
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)^M
at java.lang.reflect.Method.invoke(Method.java:597)^M
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)^M
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)^M
... 18 more^M
Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: net.sf.ehcache.CacheException^M
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)^M
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)^M
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)^M
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)^M
... 42 more^M