Claus,
I have tried it first, but there are a lot of ClassNotFoundError problems.
Even though you find the least amount of jars to be copied to the tomcat shared
lib, there are problems when you e.g. call
exchange.getIn().getBody(MyApplicationClass.class).
If the Camel core classes are loaded by a different classloader than the
application classes, the getBody returns null even if the body is not null and
is of the correct type (verified with the debugger).
I am thinking about using RMI or something like that.
Alberto
Il giorno 18/lug/2011, alle ore 10.10, Claus Ibsen-2 [via Camel] ha scritto:
> Maybe just copy that camel-cache JAR into tomcat shared lib. And then
> keep the other Camel JARs in your WARs.
>
>
> On Mon, Jul 18, 2011 at 9:42 AM, alberto.zigoni
> <[hidden email]> wrote:
>
> > 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:
> >
> > from("wherever").to("vm:queryCache")
> >
> >
> > Context B:
> >
> > from("vm:queryCache").to("cache://myCache")
> >
> > Can you suggest other ways of having the webapps sharing the cache?
> >
> > Is it possible to override Ehcache configuration with camel 2.6.0?
> >
> > Thanks
> >
> > Alberto
> >
> > --
> > View this message in context:
> > http://camel.465427.n5.nabble.com/two-webapps-on-Tomcat-sharing-cache-through-Camel-tp4598504p4598504.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
>
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/two-webapps-on-Tomcat-sharing-cache-through-Camel-tp4598504p4598564.html
> To start a new topic under Camel - Users, email
> [email protected]
> To unsubscribe from Camel - Users, click here.
--
View this message in context:
http://camel.465427.n5.nabble.com/two-webapps-on-Tomcat-sharing-cache-through-Camel-tp4598504p4598591.html
Sent from the Camel - Users mailing list archive at Nabble.com.