tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: classloader hangs
Date Thu, 05 Aug 2004 20:13:55 GMT
I know this is naive of me, but how does one get a thread dump of the
JVM?  Anyway, as for the other comments, do I have to do something
different to use URLClassLoader under Tomcat than I do in a console
application?  I kept getting this same problem under Tomcat before when
I was creating URLClassLoaders without specifying
Thread.currentThread().getContextClassLoader() as the parent, but by
adding it, the error went away.  It just seems strange that code that
worked fine stopped working when the only change I made was to insert a
package statement.  As for the NoClassDefFoundError vs
ClassNotFoundException, I do have exception handling code around the
loadClass method, and it is not reporting anything, and to the best of
my knowledge, an error should terminate the JVM right?


On Thu, Aug 05, 2004 at 11:22:03AM -0400, Shapira, Yoav wrote:
> Hi,
> If you get a thread dump of the JVM while it's hanging, what does it
> show?
> The URLClassLoader is intended for use within Tomcat.  It's nice that
> you have a program using outside Tomcat, but it's not that meaningful
> for comparison testing.  The ClassLoading scheme and hierarchy inside a
> servlet container is significantly different from the one inside a
> console Java application.
> NoClassDefFound is not an exception, it's an Error.  It's different from
> ClassNotFoundException.  And that difference (see the JavaDoc for both)
> may be the root of your problem.
> Yoav Shapira
> Millennium Research Informatics
> >-----Original Message-----
> >From: []
> >Sent: Thursday, August 05, 2004 11:17 AM
> >To:
> >Subject: classloader hangs
> >
> >Hello,
> >I am writing a class to be deployed with the Tomcat SOAP web app (I'll
> >call this class A).  It uses a URLClassloader to load classes from a
> >directory (i call them modules).  I initialize my class loader with
> >
> >URLClassLoader initialLoader = new URLClassLoader(urls,
> >           Thread.currentThread().getContextClassLoader());
> >
> >	   This worked fine for a while.  However, when I decided that
> >	   my class A needed to have a package statement (I wanted to
> >	   put it in a jar file along with some libraries for easy
> >	   distribution), I was very much dismayed when the class
> >	   loading did not work.  Yet the strange part is that it is not
> >	   the usual NoClassDefFound exception, instead the entire
> >	   program just seems to hang upon trying to load one of the
> >	   modules.  I am very dismayed as what was once working code is
> >	   now almost useless.  Chances are, I'm just making a stupid
> >	   mistake, however if anyone could please help me I would be
> >	   grateful.
> >
> >	   Thanks,
> >	   Ben
> >
> >	   P.S. This works fine when I don't run it under Tomcat, that
> >	   was my reason for posting it here.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> >For additional commands, e-mail:
> This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged.  This e-mail
is intended only for the individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the sender.  Thank you.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message