You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by tamir <ta...@movious.com> on 2002/02/13 20:55:39 UTC
HELP: class reloading or hot deployment with tomcat / Catalina ??
???
Hi there,
I'd really apperciate if anybody can give me a hint or how to relate this
issue to tomcat.
I've been struggling with this problem for two days now.
I wonder if any one have a solution.
I'm using Tomcat 3.3, but would apperciate any solution with Tomcat 4.02
The problem:
How to perfrom hot deployment for a jar file, which sits outside the
web-inf/lib (or class outside web-inf/classes).
I'd like this jar to be auto-reloaded, without my project to be reloaded.
When I put this jar inside web-inf/lib it reloads the whole server and the
session is lost.
It causes many troubles, and also the files in the jar file can't be
accessed from outside.
I tried to create my own classload using URLClassLoader inherited from
Thread.currentThread().getContextClassLoader(),
so the new created class will know all the classes created by tomcat at
web-inf/classes.
Then I create the class and everything goes well.
My problem is that the class isn't reloaded when I put the new jar in the
directory.
Here is my code:
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
URL [] jarFile = new URL[1];
jarFile[0] = new URL(new
String("/movious/portlets/mss_"+className+".jar"));
System.out.println("before loader");
loader = new URLClassLoader(jarFile,ccl);
// System.out.println("after loader");
Class c = loader.loadClass(className);
Object o = c.getConstructors()[0].newInstance(new Object[] {aData});
System.out.println("after load class"+o);
//clip = (APortletItf) o;
//clip.init(aPortletData);
return (APortletItf)o;
Each time I create a new class loader, however, the same class file is
retieved.
When I restart tomcat, It offcourse works ok.
Tnx again for you help and support
Tamir
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>