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 Define new tomcat webapp location? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Define new tomcat webapp location?" Watch "Define new tomcat webapp location?" New topic
Author

Define new tomcat webapp location?

Naveen Akshaye
Greenhorn

Joined: Apr 12, 2009
Posts: 9
Hi,

I'm setting up the tomcat web container, with the apache-connector on debian.

The default tomcat webapp folder is /var/lib/tomcat5.5.

I wonder how to change the default folder into another location where I usually save my personal project data, like $HOME/webproject.

Is it enough to change the CATALINA_BASE="/var/lib/tomcat5.5" to CATALINA_BASE="$HOME/webproject"?

I read some articles on Internet, there is another step to install apache-connector, I also installed, and created a new virtual host for tomcat, and set the directory of my webproject as the documentroot for apache to recognize. But it turns out no effect. When I start apache, and enters the url "http://localhost:9029" (9029 is the port I set for tomcat virtual host use in apache), it lists all files under the folder. It doesn't look to me that it is interpreting any pages.

Any one can help with this, to customize the default webapp directory?

Thanks very much.
Naveen.

Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8843
    
    7

Naveen Akshaye wrote:Hi,
The default tomcat webapp folder is /var/lib/tomcat5.5.


I believe the default webapp folder is /var/lib/tomcat5.5/webapps, at least it is on my Ubuntu server.
As for changing CATALINA_BASE, it is defined in catalina.sh as: "Base directory for resolving dynamic portions of a Catalina installation. If not present, resolves to the same directory that CATALINA_HOME points to", so that is not what you are looking for either.
What you probably want to do is change the appBase attribute of the Host tag in server.xml. You could also configure the docBase in a web application context. This would let you control the directory on a per-application basis.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Naveen Akshaye
Greenhorn

Joined: Apr 12, 2009
Posts: 9
Joe Ess wrote:
Naveen Akshaye wrote:Hi,
The default tomcat webapp folder is /var/lib/tomcat5.5.


I believe the default webapp folder is /var/lib/tomcat5.5/webapps, at least it is on my Ubuntu server.
As for changing CATALINA_BASE, it is defined in catalina.sh as: "Base directory for resolving dynamic portions of a Catalina installation. If not present, resolves to the same directory that CATALINA_HOME points to", so that is not what you are looking for either.
What you probably want to do is change the appBase attribute of the Host tag in server.xml. You could also configure the docBase in a web application context. This would let you control the directory on a per-application basis.


Yes, you are right. The default webapps folder is /var/lib/tomcat5.5/webapps associated to virtualhost of "localhost:8180".

I want to put all my web projects under another location. Although I can create a link of it under "/var/lib/tomcat5.5/webapps", I want to separate my data from system's apps on "localhost:8180". So I want to create a different virtual host listening to the port 9029 and with the docBase being another location like "/home/naveen/mywebproject/webapps".

Here is what I have done, but didn't work it out.
1. I installed apache connector package: libapache2-mod-jk, and configured it with worker properties. (Prerequisites of package installation are finished, apache, tomcat, apache connector)

2. I created a virtual host under /etc/apache2/sites-enabled/tomcat-host with following content:

When I go to "localhost:9029", it lists out all files under this folder. It's not what I expected.

3. I edited the file of /etc/tomcat5.5/server.xml


4. I checked the folder under /etc/tomcat5.5/Catalina, there is only one folder of "localhost". I know that's for use of default tomcat application which is under "/var/lib/tomcat5.5/webapps". There are xml files in which I can specify the docBase element. But even though I can change the "ROOT.xml" to point the root path to my project folder, the application deployed in this way is actually still on virtual host of "localhost:8180", which is not what I expected, "localhost:9029". Do I need to create another folder with different host name?

Really appreciate of any helps.

Thanks.
Naveen.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Define new tomcat webapp location?
 
Similar Threads
files in WEB-INF/classes not found?
Need someone to verify syntax in Tomcat servlet.xml
Start Tomcat 7 as tomcat user (not root user)
Still confused - Tomcat Servlet.xml
IIS url proxy to Apache Tomcat