This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes I need to create a different directory to host my servlets class files in TOMCAT 4.0 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 » Java » Servlets
Bookmark "I need to create a different directory to host my servlets class files in TOMCAT 4.0" Watch "I need to create a different directory to host my servlets class files in TOMCAT 4.0" New topic
Author

I need to create a different directory to host my servlets class files in TOMCAT 4.0

Ray Smilgius
Ranch Hand

Joined: Jan 29, 2001
Posts: 120
I have my servlets working in the examples directory but I need to create the directory
C:\myapp\iwa\servlets
I set the context in server.xml
<Context path="/myapp/iwa/servlets" docBase="myapp/iwa/servlets" debug="0" reloadable="true"/>
it does not find the servlet when I post to it.
currently the context below:
<!-- Tomcat Examples Context -->
<Context path="/examples" docBase="examples" debug="0" reloadable="true">
I can run my servlets placing all my class file servlets here without no problems.
but,I need to change the directory structure to use
C:\jakarta-tomcat-4.0\webapps\myapp\iwa\servlets
thanks in advance

------------------
Sun Certified Java Programmer
Sun Certified Java Developer
I-Net Certified
A+ Certified
Network+ Certified
MCP


SCJO, SCJD, SCWCD, I-Net+, A+, Network+, MCSD, MCDBA, MCP, MCT
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

I think you'll have better luck if you put an absolute filesystem path in the docBase attribute. By default, I believe it's relative to TOMCAT_HOME/webapps. "docBase" can be any directory, BTW, docBase doesn't have to form its name relative to the URL path. Though consistency does make it easier to maintain.


Customer surveys are for companies who didn't pay proper attention to begin with.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Tim, you are right.

docBase is relative to the Tomcat/webapps directory unless you fully specify an absolute path.

So Ray, your docBase should say: "c:\myapp\iwa\servlets"
If it doesn't, Tomcat appends "c:\jakarta-tomcat-4.0\webapps\", which is why it runs from that path, but not the other.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I need to create a different directory to host my servlets class files in TOMCAT 4.0
 
Similar Threads
tomcat context
set up context path
Tomcat 404 error
How Tomcat Works book - development question
Reloading Application