Wednesday, May 7, 2008

how to deploy war file into web root ?

Some times we need deploy our peoject into root directory of your domain (not sub directory), to solve the problem:
  1. make war file (for example myproject.war)
  2. rename the war file to ROOT.war (attention the filename must be uppercase)
  3. deploy war file
now, you can see / in tomcat web application manager page that deployed in site root.

Labels:

Wednesday, December 26, 2007

deploy war file without lib in Tomcat

At this post I'd talk about how to decrease size of big war files and make deployment faster.
I have a 15 MB war file and the size of lib (jar files) directory is 14.8 MB! So I need a solution that enables me to upload my project lib directory just for once and after that deploy my war file without lib directory.

At first I renamed my lib directory to myprojlib and then copied (for example using ftp) it to ${tomcat home}/common/lib folder on the server.
After that I modify catalina.properties file in ${tomcat home}/conf and add my myprojlib path to common.loader according below:
common.loader=${catalina.home}/common/classes,
${catalina.home}/common/i18n/*.jar,
${catalina.home}/common/endorsed/*.jar,
${catalina.home}/common/lib/*.jar,
${catalina.home}/common/lib/myprojlib/*.jar

Now save the file and restart my Tomcat.

After that I remove lib folder from my project and compile it without lib directory. Be careful don't package jar files in your project. My war file is
180KB now and I deploy it easily and I shouldn’t deploy 15 MB war file every time.

Labels: , , ,