On Saturday 11 January 2003 08:13 am, Nihita Goel wrote:
> I have added the Context information in server.xml as
>
> <Context path=""  docbase="ROOT" debug="0"/>
> <Context path="/myapp" docBase="myapp" debug="0"/>
>
>
> I checked the localhost log file and I can see messages
> Webapploader[/myapp]:Deploying class repositories to work directory
> $CATALINA_HOME/work/Standalone/localhost/myapp
> WebappLoader[/myapp]: Deploy class files /WEB-INF/classes to
> $CATALINA_HOME/webapps/myapp/WEB-INF/classes
> StandardManager[/myapp]: Seeding random number generator class
> java.security.SecureRandom
> StandardManager[/myapp]: Seeding of Random Number generator is complete
> StandardManager[/myapp:default]: Loading servlet default
> StandardManager[/myapp:invoker]:Loading container servlet invoker
>
> My class files are present in $CATALINA_HOME/Webapps/myapp/WEB-INF/classes
> directory and the web.xml is present in the WEB-INF directory....
>
> I still get the error HTTP Status 404 with description "the requested
> resource "/myapp/servlet/TestServlet" is not available.
>
> NG

You don't need to add a context for your webapp to server.xml. Add this to 
your webapp's web.xml:

<servlet>
  <servlet-name>AnyNameWorks</servlet-name>
   <servlet-class>TestServlet</servlet-class>
 </servlet>

<servlet-mapping>
  <servlet-name>AnyNameWorks</servlet-name>
  <url-pattern>/AnotherNameWorksHere</url-pattern>
</servlet-mapping>

Then try accessing the servlet with this URL:

http://localhost:8080/AnotherNameWorksHere

Tomcat requires you to map all your resources like servlets to URL patterns. 
Before Tomcat 4.1.12 a special servlet called Invoker was automatically 
mapped to /servlet/* pattern and it invoked your servlets for you. You can 
find commented out lines related to that in the server's web.xml in the conf 
directory. If you want more info search this list and check out conf/web.xml.

Paul

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to