问题
We're experiencing slightly strange webapp deployment behaviour under Tomcat 5.5.27 on Linux (both on CentOS in production and Ubuntu 10.04 for development).
App A and app B are almost identical (exactly the same libraries, a copied Maven project), App B differs only in that its JPA entities are annotated to access a different table within the same schema (the JNDI database references are identical).
When the apps are deployed into either environment, app B will not start. However:
- Manually starting the stalled app, from the Tomcat admin console, works fine (???).
- After any attempt to restart Tomcat, the alphabetically later app fails to start. Point #1 still remains valid (???)
- Logging is configured (log4j), however, we get nothing from [the yet-to-start] app B's logging, nor errors from Tomcat's 'catalina.out' log file (NB. logging is working once the apps are up and running).
I've done a reasonably thorough search for information (Apache/Tomcat bugzilla, Google) but I've found nothing of real use. Other posts have sighted the use of the antijarlocking and antiresourcelocking attributes on the server's 'context.xml' 'Context' node, but there is also a suggestion that this is unecessary/inaffective under Linux (hasn't appeared to work here, either).
Any ideas?
Cheers
Rich
P.S. Upgrading from Tomcat 5.5.x isn't an option, currently (IT support etc.).
回答1:
There is a similar behavior to spring applications on tomcat. -- They require that the webAppRootKey is unique for each application. -- If not the applications behave like you described, so in case of Spring apps, make sure that App-A has an other webAppRootKey then App-B.
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>myRootKey</param-value>
</context-param>
@See http://groups.google.com/group/riotfamily/browse_thread/thread/9a0edf69575d3ab6?pli=1
来源:https://stackoverflow.com/questions/4470609/why-is-a-tomcat-webapp-failing-when-an-almost-identical-app-starts-within-the-sa