jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fred Loney" <lo...@spiritedsw.com>
Subject Re: Classloader fails with .ejb package suffix
Date Fri, 31 Jan 2003 21:57:55 GMT
Thanks for the suggestions. The container is stopped before the move and
restarted after the move. There is one trace of the old class: it is not
cleaned from the app .jar before redeployment, although it is
unreferenced in the app. The problem is too weird. I will revisit it
later, but for now the work-around is sufficient. If you happen to
receive a report of a similar problem, then I can investigate it more
closely.

Fred Loney
Spirited Software, Inc.
www.spiritedsw.com

----- Original Message -----
From: "Vincent Massol" <vmassol@octo.com>
To: "'Cactus Users List'" <cactus-user@jakarta.apache.org>
Sent: Friday, January 31, 2003 1:14 PM
Subject: RE: Classloader fails with .ejb package suffix


> Hi Fred,
>
> Not sure if you have solved this issue. I believe one of the following
> scenario may happen:
>
> 1/ reloading scenario where you don't stop your container between the
> package move and some weird classloader reloading happens
>
> 2/ the ParentEJBTest (or another related class) is already present
> somewhere in the classloader hierarchy (for example in the system
> classloader)
>
> 3/ same as 2 but with one of the Cactus related jars
>
> 4/ other?
>
> Every now and often, I also spend a few days on CL issues although
every
> time it is usually for a stupid reason but I keep forgetting... and
> every time I vow to myself I will not do it again! If there's
something
> complex in java (but very useful!) it is classloaders.
>
> -Vincent
>
> > -----Original Message-----
> > From: Fred Loney [mailto:loney@spiritedsw.com]
> > Sent: 13 January 2003 11:05
> > To: Cactus Users List
> > Subject: Classloader fails with .ejb package suffix
> >
> > Hang on, this one gets weird fast. Running a ServletTestCase class
> with
> > the name:
> >
> > test.cases.web.framework.enterprise.ejb.ParentEJBTest
> >
> > fails in ClassLoaderUtils.loadClass(String,Class) with a
> > NoClassDefFoundError message. After a great deal of further
> > investigation, I discovered a truly bizarre phenomenon: moving the
> class
> > up to:
> >
> > test.cases.web.framework.enterprise.ParentEJBTest
> >
> > works. Move it to .ejb again, it fails. Move it back up, it works.
> Copy
> > it so both are available, the .ejb version fails, the non-.ejb
works.
> > Furthermore, even though the .ejb class cannot be found by cactus,
it
> > can be created by the non-.ejb class constructor after it is called
by
> > cactus.
> >
> > To recapitulate:
> >
> > Class.forName("...ejb.ParentEJBTest") fails
> > Class.forName("...ParentEJBTest") succeeds
> > Creating the ...ParentEJBTest succeeds.
> > The  ...ParentEJBTest constructor creates the ...ejb.ParentEJBTest
> > successfully.
> >
> > Yes, that's the same ...ejb.ParentEJBTest class that just failed in
> > forName().
> >
> >  At this point, it seems too strange to file a bug. If anybody has a
> > clue as to the cause, I'd like to hear it. I fully understand
> > classloader hierarchy and webapp structure, and have fought off
> several
> > classloader bugs in the past, but this one has me stumped. I know
the
> > string "ejb" is offensive to some humans, but I wouldn't expect a
> > classloader to choke on it!
> >
> > Details:
> >
> > I hacked cactus ClassLoaderUtils source to print debug messages. The
> > revised source adds the following to the first loadClass() catch:
> >
> >    System.out.println("******* ld failed for referrer cl - referrer:
"
> +
> > theReferrer);
> >    try {
> >     System.out.println("******* load
> > test.cases.web.framework.enterprise.ejb.ParentEJBTest");
> >                 clazz =
> >
>
loadClassFromWebappClassLoader("test.cases.web.framework.enterprise.ejb.
> > ParentEJBTest",
> >                       theReferrer);
> >        System.out.println("******* ok
> > test.cases.web.framework.enterprise.ejb.ParentEJBTest");
> >     } catch (Throwable t) {
> >     System.out.println("******* fail
> > test.cases.web.framework.enterprise.ejb.ParentEJBTest");
> >    }
> >    try {
> >     System.out.println("******* load
> > test.cases.web.framework.enterprise.ParentEJBTest");
> >                 clazz =
> >
>
loadClassFromWebappClassLoader("test.cases.web.framework.enterprise.Pare
> > ntEJBTest",
> >                       theReferrer);
> >        System.out.println("******* ok
> > test.cases.web.framework.enterprise.ParentEJBTest");
> >     } catch (Throwable t) {
> >     System.out.println("******* fail
> > test.cases.web.framework.enterprise.ParentEJBTest");
> >    }
> >
> > with the following result:
> >
> > 2003-01-13 01:08:54,835 DEBUG
> [org.apache.cactus.util.ClassLoaderUtils]
> > <loadClass([test.cases.web.framework.enterprise.ejb.ParentEJBTest],
> > [class org.apache.cactus.server.ServletTestCaller])
> > 2003-01-13 01:08:54,835 DEBUG
> [org.apache.cactus.util.ClassLoaderUtils]
> >
>
<loadClassFromWebappClassLoader([test.cases.web.framework.enterprise.ejb
> > .ParentEJBTest], [class org.apache.cactus.server.ServletTestCaller])
> > 2003-01-13 01:08:55,065 INFO  [STDOUT] ******* ld failed for
referrer
> > cl - referrer: class org.apache.cactus.server.ServletTestCaller
> > 2003-01-13 01:08:55,076 INFO  [STDOUT] ******* load
> > test.cases.web.framework.enterprise.ejb.ParentEJBTest
> > 2003-01-13 01:08:55,076 DEBUG
> [org.apache.cactus.util.ClassLoaderUtils]
> >
>
<loadClassFromWebappClassLoader([test.cases.web.framework.enterprise.ejb
> > .ParentEJBTest], [class org.apache.cactus.server.ServletTestCaller])
> > 2003-01-13 01:08:55,316 INFO  [STDOUT] ******* fail
> > test.cases.web.framework.enterprise.ejb.ParentEJBTest
> > 2003-01-13 01:08:55,316 INFO  [STDOUT] ******* load
> > test.cases.web.framework.enterprise.ParentEJBTest
> > 2003-01-13 01:08:55,316 DEBUG
> [org.apache.cactus.util.ClassLoaderUtils]
> >
>
<loadClassFromWebappClassLoader([test.cases.web.framework.enterprise.Par
> > entEJBTest], [class org.apache.cactus.server.ServletTestCaller])
> > 2003-01-13 01:08:55,316 DEBUG
> [org.apache.cactus.util.ClassLoaderUtils]
> > >loadClassFromWebappClassLoader = [class
> > test.cases.web.framework.enterprise.ParentEJBTest]
> > 2003-01-13 01:08:55,316 INFO  [STDOUT] ******* ok
> > test.cases.web.framework.enterprise.ParentEJBTest
> >
> > Error trace:
> >
> > java.lang.NoClassDefFoundError: org/apache/cactus/ServletTestCase
> >  at java.lang.ClassLoader.defineClass0(Native Method)
> >  at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
> >  at
> >
>
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> >  at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
> >  at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
> >  at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
> >  at java.security.AccessController.doPrivileged(Native Method)
> >  at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
> >  at
> >
>
org.jboss.mx.loading.UnifiedClassLoader.findClass(UnifiedClassLoader.jav
> > a:227)
> >  at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
> >  at
> >
>
org.jboss.mx.loading.UnifiedClassLoader.loadClassLocally(UnifiedClassLoa
> > der.java:235)
> >  at
> >
>
org.jboss.mx.loading.UnifiedLoaderRepository.loadClassFromRepository(Uni
> > fiedLoaderRepository.java:387)
> >  at
> >
>
org.jboss.mx.loading.UnifiedLoaderRepository.loadClass(UnifiedLoaderRepo
> > sitory.java:146)
> >  at
> >
>
org.jboss.mx.loading.UnifiedClassLoader.loadClass(UnifiedClassLoader.jav
> > a:285)
> >  at java.lang.ClassLoader.loadClass(ClassLoader.java:292)
> >  at
java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:566)
> >  at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
> >  at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:217)
> >  at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:201)
> >  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
> >  at java.lang.Class.forName0(Native Method)
> >  at java.lang.Class.forName(Class.java:217)
> >  at
> >
>
org.apache.cactus.util.ClassLoaderUtils.loadClassFromContextClassLoader$
> >
>
ajcPostAround10(ClassLoaderUtils.java;org/apache/cactus/util/log/LogAspe
> > ct.aj(1k):153)
> >  at
> >
>
org.apache.cactus.util.ClassLoaderUtils.loadClassFromContextClassLoader(
> >
>
ClassLoaderUtils.java;org/apache/cactus/util/log/LogAspect.aj(1k):1177)
> >  at
> >
>
org.apache.cactus.util.ClassLoaderUtils.loadClass$ajcPostAround7(ClassLo
> > aderUtils.java;org/apache/cactus/util/log/LogAspect.aj(1k):136)
> >  at
> >
>
org.apache.cactus.util.ClassLoaderUtils.loadClass(ClassLoaderUtils.java;
> > org/apache/cactus/util/log/LogAspect.aj(1k):1177)
> >  at
> >
>
org.apache.cactus.server.AbstractWebTestCaller.getTestClassClass(Abstrac
> > tWebTestCaller.java:331)
> >  at
> >
>
org.apache.cactus.server.AbstractWebTestCaller.getTestClassInstance(Abst
> > ractWebTestCaller.java:301)
> >  at
> >
>
org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCal
> > ler.java:142)
> > ...
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> > unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:cactus-user-
> > help@jakarta.apache.org>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>
>


Mime
View raw message