Weird classloading problem
adamw Jan 9, 2008 2:09 PMHello,
I have a really weird problem which happens only sometimes (that's the worst kind of problems) and in different ways. The only thing the symptoms have in common is ClassDefNotFoundException.
So, I have a standard seam app, generated with seam-gen, with only one exception: I have a separate .jar with interfaces and model classes which is deployed parallerly to the .ear (I separated the interfaces and model classes so I can access the ejb services from other apps).
It work fine until recently, however I have no idea when exactly the problem started to appear (as it appears sometimes, it's hard to find the cause ...).
I noticed that the errors appear more often if a method is called on regular intervals of time, beginning with the "org.jboss.seam.postInitialization" event (I use the quartz scheduler).
So the error is one of the following:
- java.lang.NoClassDefFoundError: org/jboss/seam/Instance
- java.lang.NoClassDefFoundError: org/jboss/seam/interceptor/Proxy
- java.lang.NoClassDefFoundError: <my model class>
- java.lang.NoClassDefFoundError: <my helper model class>; this exception is thrown during deserialization of that class; instances of it are held serialized in the DB.
Here is the stack trace for the first example:
19:55:49,230 INFO [Initialization] done initializing Seam 19:55:49,264 ERROR [JobRunShell] Job DEFAULT.-4531f942:1175fe7c870:-7ffd threw an unhandled Exception: javax.ejb.EJBException: org.jboss.seam.InstantiationException: Could not instantiate Seam component: feedsService at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214) at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184) at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81) at $Proxy170.update(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31) at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:50) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106) at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54) at org.javassist.tmp.java.lang.Object_$$_javassist_3.update(Object_$$_javassist_3.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125) at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52) at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76) at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45) at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:304) at org.quartz.core.JobRunShell.run(JobRunShell.java:203) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: feedsService at org.jboss.seam.Component.newInstance(Component.java:1962) at org.jboss.seam.Component.getInstance(Component.java:1865) at org.jboss.seam.Component.getInstance(Component.java:1832) at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2174) at org.jboss.seam.Component.getValueToInject(Component.java:2126) at org.jboss.seam.Component.injectAttributes(Component.java:1590) at org.jboss.seam.Component.inject(Component.java:1408) at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106) at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) ... 42 more Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: org/jboss/seam/Instance at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:190) at org.jboss.seam.Component.createProxyFactory(Component.java:2252) at org.jboss.seam.Component.getProxyFactory(Component.java:1367) at org.jboss.seam.Component.wrap(Component.java:1358) at org.jboss.seam.Component.instantiateSessionBean(Component.java:1280) at org.jboss.seam.Component.instantiate(Component.java:1265) at org.jboss.seam.Component.newInstance(Component.java:1958) ... 70 more Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: org/jboss/seam/Instance at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:165) at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:186) ... 76 more Caused by: java.lang.NoClassDefFoundError: org/jboss/seam/Instance at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:177) at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159) ... 77 more
(here you can see the quartz schduler at work, but it also happens when this is turned off, and looks very similar).
Anybody has any ideas, where at least I can start looking?
--
Adam