You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nihita Goel <ni...@tifr.res.in> on 2003/01/11 08:17:11 UTC

HTTP Error 404 with Tomcat 4.1.18

Hi,

Would be grateful if anyone could help.

It is something basic  but I have been trying and there's no help ...

I have installed TomCat 4.1.18 over RH Linux and am able to run
succesfully but for a problem I am facing in deploying my own
application.

As given in the documentation I have created a directory myapp under
$CATALINA_HOME/web-apps/

With-in myapps is WEB-INF/classes where I have copied by
HelloServlet.class file. According to the documentation on giving
http://localhost:8080/myapp/servlet/HelloServlet in browser I should be
able to run my servlet but I get the error HTTP Error 404 : cannot find
resource.  If I copy the same to example/WEB-INF/classes it works.. What
is the problem? I also tried creating web.xml in WEB-INF directory but
still I get the same error..

Do I need to add /change anything in server.xml file ?

Also I tried copying the index.jsp from ROOT to myapps and then if I
give localhost:8080/myapps/index.jsp it runs ...

Pl help

N.G



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HTTP Status 404 with Tomcat 4.1.18

Posted by Nihita Goel <ni...@tifr.res.in>.
Thanks It is working this way.
Nihita

Paul Yunusov wrote:

> On Saturday 11 January 2003 10:03 am, Paul Yunusov wrote:
> > 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
>
> Sorry there, the URL should be
> http://localhost:8080/myapp/AnotherNameWorksHere as your context name seems
> to be myapp.
>
> Paul
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Nihita Goel
Head, ADP Cell
Tata Institute of Fundamental Research
Mumbai
Ph : 2152971 Extn 2548



Re: HTTP Status 404 with Tomcat 4.1.18

Posted by Paul Yunusov <py...@rogers.com>.
On Saturday 11 January 2003 10:03 am, Paul Yunusov wrote:
> 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

Sorry there, the URL should be 
http://localhost:8080/myapp/AnotherNameWorksHere as your context name seems 
to be myapp.

Paul

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HTTP Status 404 with Tomcat 4.1.18

Posted by Paul Yunusov <py...@rogers.com>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HTTP Status 404 with Tomcat 4.1.18

Posted by Nihita Goel <ni...@tifr.res.in>.
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


> Hi,
>
> Would be grateful if anyone could help.
>
> It is something basic  but I have been trying and there's no help ...
>
> I have installed TomCat 4.1.18 over RH Linux and am able to run
> succesfully but for a problem I am facing in deploying my own
> application.
>
> As given in the documentation I have created a directory myapp under
> $CATALINA_HOME/web-apps/
>
> With-in myapps is WEB-INF/classes where I have copied by
> HelloServlet.class file. According to the documentation on giving
> http://localhost:8080/myapp/servlet/HelloServlet in browser I should be
> able to run my servlet but I get the error HTTP Error 404 : cannot find
> resource.  If I copy the same to example/WEB-INF/classes it works.. What
> is the problem? I also tried creating web.xml in WEB-INF directory but
> still I get the same error..
>
> Do I need to add /change anything in server.xml file ?
>
> Also I tried copying the index.jsp from ROOT to myapps and then if I
> give localhost:8080/myapps/index.jsp it runs ...
>
> Pl help
>
> N.G
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>