From: Marc Dumontier [EMAIL PROTECTED]
Sent: Tuesday, March 04, 2003 1:32 PM
Subject: reloading applications - classes stay in memory?
Hi,
I'm using the ant task to reload my web application during development.
The problem is that I have a huge run time library (takes about 45
seconds to load up the class itself). The static block is executed each
time i reload (these are not servlets - they are JAXB generated
classes). Is there any way to keep those classes loaded into tomcat, so
when i reload the class is already initialized? is there an alternate
method for accomplishing this?
Place these classes outside of the WAR and into shared/classes or
shared/lib.
The problem is that when the app reloads, the classloaders for the app get
destroyed and recreated. A class within the JVM is actually the combination
of the class and its class loader.
If you place the classes outside of the WAR, then those class loaders will
not be reinitialized when the app is restarted.
Of course, should those classes change, you'll need to restart Tomcat.
Also, you should still, I feel, bundle those classes properly within the WAR
for deployment and production, but to expedite development, this should work
fine.
However there may be problems if it's using any reflection to load classes
that are also within the WAR, as the shared/* class loaders can not see any
classes within the WAR.
So, if your class shared.lib.TestClass does something like
Class.forName(in.the.war.TestClass), it will fail.
Regards,
Will Hartung
([EMAIL PROTECTED])
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]