axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srinath Perera <hemap...@gmail.com>
Subject Re: Axis Hot Deployment
Date Sun, 05 Dec 2004 15:14:43 GMT
On Fri, 03 Dec 2004 13:26:40 -0500, Andrea Matsunaga <ammatsun@ufl.edu> wrote:
>     I saw in the mailing lists and web site that hot deployment
> of services are in the plan for Axis 2. I also saw that you did
> dynamic class loading done for axis-geronimo using ClassUtils.
>     My current environment runs Axis 1.2RC1 on Tomcat 5.0.25.
> In my project I need the hot deployment feature in the sense that
> 1) When a new service is deployed, the application is in a jar file
> and Tomcat does not load it since it was not in the axis web
> application "classpath" suring startup; 2) Even if the application
> is unjared  into WEB-INF/classes (which Tomcat recognizes),
> it is not possible to redeploy it (Tomcat does not reload).
>     Because of this, I decided to change Axis to create a separate
> classloader for each web service and set the context classloader
> accordingly. However, I could not make it work (when the application
> classes are loaded, I get NoClassDefFound exception which
> probably means that there is a link somewhere that cannot be
> solved). Another difference in my environment is that I modified
> Axis 1.1 RC1 to use XMLBeans for de/serialization since the
> applications classes were created with XMLBeans.
>     Therefore, I would like to know which changes have you made
> to get the dynamic loading with ClassUtils and if there is any place
> where I could look your source code. Also, did you create various
> ClassLoaders? If so, in which part of Axis you included a way
> to re/set the proper ClassLoader? My way to implement this was
> to add a parameter "classpath" in the wsdd file while deploying the
> service and reusing it in case the web server is restarted.. So the
> main "switch" happens in WSDDService and SOAPService.
> Is there a better place for this to happen?
> 
> Thanks a lot.
> --andrea
> 
> 
Hi Andrea;  
hot deployment in the Axis 1.x can be have with following trick
1) ClassUtils is a static Hashmap that stores the ClassLoaders against
the classname. Axis uses this to load all the classes.
2) What you got to do is to start a thread from your Axis Servlet
(modify it!) to keep looking at the Axis Web-inf/lib. When you see a
new jar create a classloader with the Thread contxt classloader set as
the parent and add that classloader to the ClassUtils with the
classname name you find in the deploy.wsdd
e.g. 

	MyThread(){
		void run(){
			File file = waitTillNewJarAdded();
			File deployConf = findDeployWSDD();
			String className = parseDeployWSDDAndFindClassName(deployConf );
			ClassLoader cl = new URLClassLoader(new URL[]{file.toURL()});
			ClassUtils.setClassLoader(className,cl);
			deployWithAdminClient(deployConf );
			
		}
	}

But aware this break the j2ee rule of not creating a threads from a
servlet!. That will not do any harm! but I do not see anyway to have
hot deployment with out thread.

Mime
View raw message