I'm using spring with tomcat, and the app seems to work fine, but now I'm doing some caching stuff, and I'm running into problems. It appears that I'm getting four instances of every "singleton" created in the app. If I put a log message in like log.error("Object address: " + this); into the code, then it spits out four different object addresses, four different times. If I put a breakpoint into my debugger inside a "singleton" constructor, it calls it four times (multithreaded)! What the heck is going on? Why is my spring container duplicating everything four times???
Can you post the multithreaded code and sections where you are retrieving the spring beans or the bean definition?
------ Regards Ravindra
posted 12 years ago
I figured it out. It was my virtual hosting settings. I was using webapps as the appBase in the host tag. I needed to add the directory of the app onto that. like webapps/ROOT and webapps/customerportal. What was happening (if you looked in the work directory) is that it was creating ALL the apps for every virtual host mentioned in the server.xml file. It's all fixed now and I'm down to one singleton per app as life should be....
What's that smell? I think this tiny ad may have stepped in something.