tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jagadish Gopi <>
Subject FW: Error when reading a servlet
Date Mon, 20 Aug 2001 13:59:26 GMT

HI Richard,

Thanx a lot for replying back. 

I have followed all your advices but still am facing the same problem.

I have given something like this within my server.xml file
<Context path="/health"
crossContext="true" debug="0" reloadable="true"></Context>

-> here the main reason why i have given docBase="/jaka......" is coz if I
give in as docBase="/webapps/com...." I get a error something like this 
" access denied (
C:\webapps\com\health\wls\servlets read) "
, Compiled Code)
Compiled Code)
at ...
 What I want you to note is it's looking for files within c:/webapps... but
actually I have dir structure as c:/jakara-tomcat-3.2.1/webapps.... 

One more doubt I had , you had written asking me to give within server.xml
file, something like this
<Context path="/health" docBase="webapps/health" etc...></Context>  

->Please tell me if I give in docbase as "webapps/health" how will it know
the exact servlets path... which is within webapps/com/health/wls/servlets

->And within my web.xml file which is within dir c:/jakarata-3.2.1/conf I
have created a servlet tags like 

Now in the my url address if I give ~localhost:8080/health/HealthLogin it
gives me a error saying page cannot be found.

Please let me know what mistake I am doing here...
Thank You

-----Original Message-----
From: Richard Draucker []
Sent: Friday, August 17, 2001 7:42 PM
To: Jagadish Gopi
Subject: RE: Error when reading a servlet

I think what you're trying to accomplish is to create an alias for your 
servlet.  And while what you have sorta looks like it should work, its
not the way tomcat does this.

I have created a Context within server.xml file, something of this sort

<Context path="/health" 
              reloadable="true" >


First, make sure your context code is closed up rather than on multiple 
lines.  It may just have come out this way in the email, but I thought I'd 
mention it in case that's how you typed it. 

Second, the context is for the entire web application and can't reference a 
servlet.  It should be pointing to the root of a web application, which must

adhere to a defined structure.  For example...
<Context path="/health" docBase="webapps/health" etc...></Context>  //
Please tell me if I give in docbase as 			"webapps/health" how
will it know the exact servlet path... which is within

Third, to make the servlet load as the default index page, the easiest way
to add a servlet mapping to the web.xml file in WEB-INF under your web 
application, the structure of which should define a path consistent with:

The WEB-INF directory (caps required, even in Windows) will contain a
file, a sample one can be found in tomcat/lib along with the servlet.xml
Add the following to the web.xml between the <webapp> tags.



This will cause the HealthLogin servlet to run when the url-pattern shown is

entered as the target addrss.   So the url: ~//localhost/index.html will
an index.html file from the ~/webapps/health directory.  And  the url 
~//localhost/health/HealthLogin will run the HealthLogin servlet 

View raw message