开发者

Tomcat webapp configuration on linux

I have a webapp (springmvc 3.0.5/java 1.6 based) that I'm deploying to a tomcat (6.0.32) web server on a linux machine. Currently I copy the war file out to the server and let tomcat unpack it for me.

relevant lines in server.xml:

开发者_运维技巧<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
  <Context docBase="fooapp" path="/" reloadable="true" source="org.eclipse.jst.jee.server:Fooapp"/>
</Host>

I want the webapp context path to be "/" so I don't have to add /fooapp/ to every url. http://www.mydomain.com/index.html instead of http://www.mydomain.com/fooapp/index.html

The issue is that in my current configuration the webapp is served from BOTH "/" and from "/fooapp" context paths because tomcat unpacks the war twice. Once to the fooapp directory and another time to the ROOT directory.

I'd like the web application to be unpacked just once to the fooapp directory and still served from the "/" context path. Can this be done on linux and if so how?

Note: This works on windows exactly as I want so I'm hopeful that linux can do the same thing.


The simplest method:

  1. Delete your Context tag from the server.xml,
  2. delete webapp/fooapp and webapp/ROOT directories,
  3. copy your fooapp.war to the webapp directory as ROOT.war.

You can find some other methods in the Tomcat's documentation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜