Get your CodeRanch badge!*
The moose likes Tomcat and the fly likes WebApps directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "WebApps directory" Watch "WebApps directory" New topic
Author

WebApps directory

Sunder Ganapathy
Ranch Hand

Joined: Apr 01, 2003
Posts: 120
Is it compulsory to have one's application immediately under webapps directory? I want to have my application to be accessed as http://localhosts:8080/a/b/Servlet, where a is under webapps and b is in a.

Some previous discussions at this place have given some solutions and they do not work. For example, Configure Tomcat 6 to serve applications in other than default directory, does give one solution and it does not work. While starting, Tomcat 6.0.14, it gives serious error.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It is compulsory to have a well formed application directory structure (there has to be a 'WEB-INF' directory in the root of your application.

As long as you have a proper directory structure, you can configure Tomcat to deploy it from any directory that it can see.

To do this, you can add a <Context .../> entry to your server.xml (old way) or create a context fragment file in tomcat/conf/Catalina/localhost with the <Context .../> tag in it (best practice).
With either approach, just add a the path to your app in the docBase attribute.

See:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WebApps directory
 
Similar Threads
New Wep app servlets don't work
getContextPath()
Tomcat6 and Java Beans
How to run jsp on TOMCAT?
integrating servlet application into a website