Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Tomcat 7 : Deployment Problem When unpackWARs is false in server.xml  RSS feed

Prashant Chotu
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to deploy my grails application in Tomcat 7.0.27

My application lib directory contains some properties file as well along with the Jars.
In tomcat server.xml, When I set unpackWARs false (compressed deployment), then apache-tomcat-7.0.27/work/Catalina/localhost/_/WEB-INF/lib directory contains only Jars not the properties files which I have in my application lib.
I also tried putting properties file in tomcat lib, But no lock.. . Is there any configuration in tomcat to troubleshoot this issue ?

Also when unpackWARs is false, there are only two folders lib and classes in apache-tomcat-7.0.27/work/Catalina/localhost/_/WEB-INF/. This is also creating a new problem as my application searches for some other folders also in WEB-INF. This works good with unpackWARs true.

Any help on the above two problems will really be appriceated

To overcome the above two problems, I can set unpackWARs true, but there is a problem in extracting the war. Suppose my war file name is ROOT.war and the ROOT folder is already existing in webapps, then the server starts do not extract the ROOT.war and my app goes up with the old ROOT folder.
What should be the best way to clean up existing extracted war folder ROOT ? For now, I am deleting the existing ROOT folder in the start up sctipt /etc/init.d/tomcat.

Should I set unpackWars true or false ?

Many many Thanks in advance..

The OS I am using is RHEL 5.2 .. Please let me know If you need more info

Prashant Gupta
Tim Holloway
Posts: 18662
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Prashant!

I have not verified for Tomcat7, but in earlier versions of Tomcat, if there was an unexploded WAR (WAR file) and an exploded WAR (directory) with the same base name (with/without ".war"), the exploded WAR took precedence. Replacing the WAR file would not update the exploded WAR directory and the exploded WAR directory was what the webapp actually ran from. So to do a "proper" update, you would have to delete the exploded WAR directory. And, for best results, corresponding directories in TOMCAT_HOME/woek and TOMCAT_HOME/temp.

I am not certain, but it sounds like you are attempting to use TOMCAT_HOME/webapps as a general-purpose directory, storing data in it. Don't do that. Only WARs should be stored there. and you should never attempt to write data into a WAR. Always use an external location. And by "external", I don't just mean external to the webapps directory, I mean external to the entire Tomcat server. On a Linux system, the common practice is to use /var/lib/appname as the base directory for files that can be written or updated.

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!