[jboss-user] [JBossCache] - Re: ClassCastException/instanceof fails when getting object

jason.greene@jboss.com do-not-reply at jboss.com
Wed Oct 10 17:56:23 EDT 2007


"dode" wrote : Naaawww, that "trick" with setting UseJBossWebLoader to true in jbossweb-tomcat55.sar/META-INF/jboss-service.xml doesn't really work either - as soon as I redeploy the webapp I get a ClassCastException again. It seems upon redeploying a new classloader is used so it is again not the same as the one used by the cache.
  | After a restart it works fine again - until I redeploy the webapp.
  | 
  | Torsten

Since the cache holds a reference to the object you ask it to store, and since that reference is tied to a class, then the lifespan of the class has to last as long as the cache entry exists. So in other words, if you are going to put stuff in the cache that outlives your deployments, then you need to move those custom types to a deployment that lasts as long as your cache entry. A separate jar file would do.

Also you might want to stay away from UseJBossWebLoader=true, especially if you are using jsps (since classname conflicts are high).

-Jason

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093752#4093752

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093752



More information about the jboss-user mailing list