Scott Brickner <[EMAIL PROTECTED]> writes: > "Different contexts" isn't necessarily the same as "different JVMs". > I think that tomcat uses a single JVM instance for all of the > webapps. They just use different classloaders to keep things from > "accidentally" interfering with one another. This might be as simple > as explicitly loading the common class through the system > classloader.
Scott B. is right on. What you want to do is implement the cache based on some static field of a class placed in Tomcat's shared classloader. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html This static field will reference the same object in both of your web applications, and can point to your cache (using the singleton pattern for this would work well). Scott W.'s suggestion of XML-RPC (very easy to implement) and Scott B.'s suggestion JCS only work for certain use cases. If you're going to be making lots of calls to these shared objects, you don't have the right use case for these schemes. Another possiblity (mentioned for academic completeness) would be to use Servlet API 2.3's RequestDispatcher interface and pass just the data you need between web apps as they call each other internally. This doesn't give you shared objects per say, but does provide you with the data you need and opens up other sorts of possibilities (likely not useful for your case). - Dan -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
