Deploy war application in Tomcat as ROOT

After deploying the war file in webapps,

I need something like this:
http://www.mysite.com/
NOT this:
http://www.mysite.com/myapp/

 

There should be 3 ways to do it:

1.

rename the war to ROOT. war

 

 

2. 

create a new HOST entry in TOMCAT_HOME/conf/server.xml

  1. <Host name=”www.mysite.com” appBase=”www”
  2.       unpackWARs=”true” autoDeploy=”true”
  3.       xmlValidation=”false” xmlNamespaceAware=”false”>
  4. </Host>

with this sample setup, you will have a folder in the root of TOMCAT_HOME called ‘www’, and it will only work with the host name www.mysite.com – all other requests (localhost, 127.0.0.1, etc) will hit the localhost host configuration.

In the ‘www’ folder you need to have a ‘ROOT’ folder, which again contains the contents of your ‘myapp’.

 

 

3.

Deploy war as (for example) war_name.war and configure the context root inside the < Host > element of conf/server.xml to use your war file :

<Context path="" docBase="war_name" debug="0" reloadable="true"></Context>




The first one is easier, but a little more kludgy. 
The second one works for specific domain.
The third one is probably the more elegant way to do it.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s