Sharing jars (or modules) between web application contexts in Idea

I want to run two webapp contexts /foo and /bar inside of idea (i use Selena build 7065). I allow the contexts to access each other's servletContext by specifying crossContext="true" in the /META-INF/context.xml of each context.

Now, to do anything useful with this setup I need to ensure that both class loaders see the same dependencies (.jars). In a standalone Tomcat configuration I believe the standard way of doing this is to drop them in CATALINA_HOME/shared/lib.

First, this "standard way" does not seem to work when running the apps inside of Idea. Can I fix this?

Better still, can I accomplish the same thing some other way (without dropping things into my tomcat installation).

Or even better, can I configure /foo and /bar to share a Java module in Idea in such a way that cross context access will work?

Thanks in advance,
- Torsten

2 comments
Comment actions Permalink

I want to run two webapp contexts /foo and /bar
inside of idea (i use Selena build 7065). I allow the
contexts to access each other's servletContext by
specifying crossContext="true" in the
/META-INF/context.xml of each context.

Generally a bad idea, and a good indication they should be the same webapp rather than two different ones.

Now, to do anything useful with this setup I need to
ensure that both class loaders see the same
dependencies (.jars). In a standalone Tomcat
configuration I believe the standard way of doing
this is to drop them in CATALINA_HOME/shared/lib.

Equally a bad idea. Anything placed there is accessible to the entire server with no way to override it at application level.
If you put a jar there and need a different version of a class in that jar in some web application your only recourse is to run it in a different Tomcat installation.

First, this "standard way" does not seem to work when
running the apps inside of Idea. Can I fix this?

Combine the apps into one, or find some other way for them to communicate (like HTTP requests or RMI).

0
Comment actions Permalink

I'm bulding a portal. Portlets are deployed as separate contexts, just as they are in other portlet containers, such as the reference implementation Pluto.

If this is a bad idea, then I'm interested in any alternatives you can come up with.

However, I was actually looking for is advise on how to run such a setup inside Idea.

Regards,
- Torsten

0

Please sign in to leave a comment.