Classloader Problems
darranl Jun 5, 2003 6:55 AMHi,
I am currently having a problem redeploying the application the application that I am developing, between each deployment I am having to restart JBoss to clear the class loaders.
My application consists of a couple of jars containing EJBs, some sars containing services a rar, the required configuration files and a couple of jars containing classes used by some of the other components. Everything is packages up into a single ear file (Darran.ear).
After deploying the application I run a client application which puts a number of instances of ClassX into a hashtable and passes the hashtable into a session bean that in turn passes it onto a resource adapter. The resource adapter then checks using instanceof that each object contained in the hashtable is an instance of ClassX.
When I run the application after the first deployment everything is fine and the ClassX instances passed in are correctly identified.
Next I remove the Darran.ear from the deploy folder, I then recompile the application and deploy the newly generated 'Darran.ear'.
Now when I run the application that passes in instances of ClassX the comparison fails.
Just before performing the comparison I have output the results of obj.getClass().getClassLoader().toString() where obj is the instance being tested.
- org.jboss.mx.loading.UnifiedClassLoader3@a3f178{
url=file:/C:/jboss-3.2.1_tomcat-4.1.24/server/all/tmp/deploy/
server/all/deploy/Darran.ear/53.Darran.ear ,addedOrder=35}
I have also output the results of new ClassX().getClass().getClassLoader().toString()
- org.jboss.mx.loading.UnifiedClassLoader3@837645{
url=file:/C:/jboss-3.2.1_tomcat-4.1.24/server/all/tmp/deploy/
server/all/deploy/Darran.ear/56.Darran.ear ,addedOrder=38}
Even though I completely removed the first instance of the application before deploying the second it appears that the first one is being cached and used still.
I know that the client application is definately using the correct version of all classes as the build script I am using replaces the jars used by the client at the same time as createing the ear.
Has anyone else seen anything like this before?
Thanks in advance for any help.
--
Darran.