File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes How to deploy to Root of Tomcat for Website? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to deploy to Root of Tomcat for Website?" Watch "How to deploy to Root of Tomcat for Website?" New topic
Author

How to deploy to Root of Tomcat for Website?

Khosrow Moossavi
Greenhorn

Joined: Aug 08, 2005
Posts: 26
How can I deploy my site to a Tomcat web server, in order to show it at the Root of the Site?

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

I've tried to deploy the .war file which had been renamed to ROOT.war but it's not working. And with anyother named .war file it's deployed to the /myapp/ uri.

The server is Windows and IIS and Tomcat.
Control Panel is Plesk 8.4.

Many Thanks.


SCJP and SCWCD are going to be installed here.
Khosrow Moossavi
Greenhorn

Joined: Aug 08, 2005
Posts: 26
Anyone??
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

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

e.g.


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'.


Regards, Rene Larsen
Dropbox Invite
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
I've tried to deploy the .war file which had been renamed to ROOT.war but it's not working.


Any valid application .war unpacked into the ROOT directory should work. Exactly what did you do and what happens? "not working" is not very informative.

Bill


Java Resources at www.wbrogden.com
Khosrow Moossavi
Greenhorn

Joined: Aug 08, 2005
Posts: 26
Rene :
You can create a new HOST entry in TOMCAT_HOME/conf/server.xml


Well, I don't have access to TOMCAT_HOME/conf/server.xml. It's a shared hosting. BTW, Isn't this configuration only working for Local Websites?


Bill :
Exactly what did you do and what happens? "not working" is not very informative.


Sorry for not being so informative. I had the domain, and just purchased the hosting. It's a shared Hosting Plan which is a Windows-Based Server with IIS and Tomcat Module. Hosting Control Panel Plesk 8.4.

When I depoly the myApp.war (which is valid. works fine on my computer) the site would be accessible through this url : http://www.mysite.com/myApp/ (works ok too!)
but I want the site would be accessible through this url : http://www.mysite.com/

So I've tried to rename the war file to ROOT.war (which should be deployed to TOMCAT_HOME/webapps/ROOT/ (Isn't it?) ) in order to get this done. But it's neither loading the myApp nor responding any HTTP's Error Page or Tomcat's Error Page. Just a Blank Page.

I'm currently don't have access to Tomcat's Log too, so I can't see Stack Trace or something.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Well, I don't have access to TOMCAT_HOME/conf/server.xml. It's a shared hosting. BTW, Isn't this configuration only working for Local Websites?

It is also working from outside your local site - but only with the domain used in the host setup.

So I've tried to rename the war file to ROOT.war (which should be deployed to TOMCAT_HOME/webapps/ROOT/ (Isn't it?) ) in order to get this done. But it's neither loading the myApp nor responding any HTTP's Error Page or Tomcat's Error Page. Just a Blank Page.

For this to work, you need to overwrite the ROOT folder - or delete it, and then deploy a ROOT.war file, which then when it deploys will be to a ROOT folder.
[ December 25, 2008: Message edited by: Rene Larsen ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to deploy to Root of Tomcat for Website?
 
Similar Threads
Java System Application Server 9 Main Context root
Internet requests to Tomcat
query strings
Internet requests to Tomcat
Tomcat settings in an production environment?