Classloading issues with Tomcat JNDI and Replication

View: New views
1 Messages — Rating Filter:   Alert me  

Classloading issues with Tomcat JNDI and Replication

by majohnst :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have setup replication between several of our webservers. Each webserver runs multiple apps that need to access the cache, so we exposed Ehcache as a JNDI resource. This way all the apps within a tomcat instance can use the same cache. The replication works correctly for basic string based cache items. But now I am wanting to cache a POJO and I get a classcast/class not found exception.

I understand why this happens, because ehcache is loaded by the tomcat system classloader and the webapps are loaded through a different classloader. If I just put my POJO class in the tomcat system class loader, everything would work correctly. But I really don't want to do that.

Is there any way to tell ehcache/rmi to load classes from my WAR file?