camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alberto.zigoni" <>
Subject two webapps on Tomcat sharing cache through Camel
Date Mon, 18 Jul 2011 07:42:14 GMT
I have defined a Camel context with a route creating and populating a cache.
This camel context is included into a web application deployed on Tomcat.

The route creating and populating the cache is fired at startup using a Quartz endpoint. Everything
works fine.

Now I want to query that cache from another web application deployed to the same Tomcat server
(i.e. same JVM for the two webapps), using a dedicated Camel route.

The problem is that the CacheManager instantiated by Camel is a singleton within the scope
of the classloader and, since Servlet API reverses the standard classloading hierarchy, the
two webapps each create their own CacheManager, so they cannot share the cache.

I am using Camel 2.6.0.

I have found an ugly workaround, which is to delete all the jars from the WEB-INF/lib directories
and copy them into Tomcat lib directory.

Another workaround that I am trying is to query the cache through a vm: endpoint from one
Camel context to the other, like this:

Context A:


Context B:


Can you suggest other ways of having the webapps sharing the cache?

Is it possible to override Ehcache configuration with camel 2.6.0?



View this message in context:
Sent from the Camel - Users mailing list archive at
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message