I have two tomcat web applications that need to share information using a singleton. I have already made it work by placing the jared classes in the tomcat common directory. Each webapp then gets the same copy of the singleton. What I would like to do is to integrate this behavior within eclipse. I would like the common classes to be a single project that gets incorporated into the tomcat common class loader every time I start the tomcat server within eclipse. Anyone knows how to configure eclipse to do this?
I have two tomcat web applications that need to share information using a singleton.
Share
I’ve managed to get it working. Here is what I did:
commonproject in the eclipse workspace.firstandsecond, that should share thecommonproject.When the web applications are created a
Serversproject is created with the tomcat configuration.catalina.propertiesinside the Servers project and add the lineshared.loader=/path-to-workspace/common/bin.This works perfectly for development. Every time a new build is created everything is in sync. For deployment You need to convert the
commonproject into acommon.jarand place it in${catalina.home}/lib.