开发者

Problem updating existing webapp in Tomcat 6.0.20

In Tomcat 5, I would build a WAR file and plac开发者_JAVA技巧e it on my test server. On this server there was a my-app.xml file in the CATALINA_HOME/conf/[EngineName]/[HostName] directory that pointed to my test database. Once I finished testing, I would send the WAR file to my clients IT department and they would put the file in the CATALINA_HOME/webapps directory. On their instance of Tomcat, they had a different my-app.xml file that pointed to the production database.

Recently we upgraded to Tomcat 6, when either of us copy the WAR file into the webapps directory, it deletes the my-app.xml file. After it is deleted, if I copy a backup of my-app.xml file into the CATALINA_HOME/conf/[EngineName]/[HostName] directory, Tomcat ignores it, even if I reload the webapp from Tomcat Manager.

I tried adding a context.xml file to the META-INF directory in the WAR file. When Tomcat was expanding the WAR file, it would overwrite the my-app.xml file with the context.xml file. If I then copied the backup of my-app.xml file back into the CATALINA_HOME/conf/[EngineName]/[HostName] directory, Tomcat deletes the WAR file and the expanded directory.

I can include the appropriate my-app.xml file inside the WAR file, but this means building two WAR files, one with the test my-app.xml and one with the production my-app.xml. I also can get it to work if I copy the WAR files or the my-app.xml backup files in a specific order into the correct directories. I am not fond of either of these solution for multiple reasons.

What am I doing wrong? Why does this not work in the new version? Do I need to change an option? Do I need to change my process? (NOTE: The client's IT department does not want to have to stop and start Tomcat to redeploy a new WAR file.)

Thanks!


It sounds like Tomcat's auto-deploy is interfering with your manual deployment. Try either deploying your WAR file to another directory (i.e. not the webapps dir) or turning of autoDeploy in your server.xml. There's some more notes here: http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#Automatic%20Application%20Deployment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜