Classloading problem in redployment
sanjitcs Jun 21, 2010 3:14 AMHello everybody,
I have a curious problem with redployment same class gives classcastException
I have Enterprise application (test-app.ear) following is the architecuture of the ear.
test-app.ear
+ META-INF
++ application.xml
+ test-app.jar
+++ test-app-jboss-beans.xml
+++ test-model.jar
...
...
+test-web.war
++ WEB-INF
+++ jboss-web.xml
+++ web.xml
+++ lib
+++ classes
++ (swf files)
Apllication is also using quartz service to schedule the job and run job to execute the business logic. The jar files present in test-app.jar file is used by quartz services which is present in deploy directory.
The first time I start jboss server all works fine, application is able to schedule the job and run the job as expected. The problem comes when I redeploy the app. Once the application gets redeployed, when I access the application. It schedule the job when quartz tries to execute the job it gives classCast exception for same class.
Following is the error
java.lang.ClassCastException: com.test.mv.model.Subscriber cannot be cast to com.test.mv.model.Subscriber
2010-06-18 23:35:22,748 ERROR [STDERR] (DefaultQuartzScheduler_Worker-1) java.lang.ClassCastException: com.test.mv.model.Subscriber cannot be cast to com.test.mv.model.Subscriber
2010-06-18 23:35:22,748 ERROR [STDERR] (DefaultQuartzScheduler_Worker-1) at com.test.mv.logic.jobs.ExecutionContext.<init>(ExecutionContext.java:17)
2010-06-18 23:35:22,748 ERROR [STDERR] (DefaultQuartzScheduler_Worker-1) at com.test.mv.logic.jobs.ExecutionContext.fromJobExecutionContext(ExecutionContext.java:22)
2010-06-18 23:35:22,749 ERROR [STDERR] (DefaultQuartzScheduler_Worker-1) at com.test.mv.logic.jobs.TestJob.execute(TestJob.java:152)
2010-06-18 23:35:22,749 ERROR [STDERR] (DefaultQuartzScheduler_Worker-1) at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
2010-06-18 23:35:22,749 ERROR [STDERR] (DefaultQuartzScheduler_Worker-1) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:534)
It seams is the problem with class gets loaded by different classloader in case of redeployment.
Can anybody help me out how I can resolve this problem.