You didn't mention anything about a HelloWorld Servlet before. You have not configured the context of your webapp, and tomcat does not even know it exists. Create a file called onjava.xml and place it in your webapps directory. This should contain something along the lines of:
<context path="onjava" docBase="./onjava" debug="0" privileged="true"> Also, make sure your HelloWorld servlet is mapped-in in your webapps deployment descriptor. By the way, the folder should be called WEB-INF not web-inf. HTH stu -----Original Message----- From: Jim Si [mailto:[EMAIL PROTECTED] Sent: 29 August 2003 16:57 To: Tomcat Users List; Stuart MacPherson Subject: Re: First Servlet 404 error I tried it but it still does not work. I even tried to put a HelloWorld.class file into webapps\onjava\Web-inf\classes directory and use link http:\\localhost:8080\onjava\servlet\HelloWorld I still have the same error. But when I put HelloWorld.class file into webapps\examples\Web-inf\classes, then it works. What it might be the problem? Jim Stuart MacPherson wrote: > In your JSP form change this: > > <form name="loginForm" method="post" action="servlet/com.onjava.login"> > ...... > </form> > > to this: > > <form name="loginForm" method="POST" action="com.onjava.login"> > ...... > </form> > > [Note the capitals in POST also] > > -----Original Message----- > From: Jim Si [mailto:[EMAIL PROTECTED] > Sent: 28 August 2003 21:37 > To: Tomcat Users List > Subject: First Servlet 404 error > > It is difficult to get my first servlet working. I got HTTP Status 404 - > /onjava/servlet/com.onjava.login error. Maybe something I did not get it > right. > Here are the things I have. > > Tomcat 4.1.27 > > In conf/server.xml, I added the following line. > <Context className="org.apache.catalina.core.StandardContext" > crossContext="true" reloadable="true" > mapperClass="org.apache.catalina.core.StandardContextMapper" > useNaming="true" > debug="0" swallowOutput="false" privileged="false" displayName="On Java > Example" > wrapperClass="org.apache.catalina.core.StandardWrapper" docBase="onjava" > cookies="true" path="/onjava" cachingAllowed="true" > charsetMapperClass="org.apache.catalina.util.CharsetMapper"> > </Context> > > In conf/web.xml, I uncomment the invoker mapping, i.e. > <servlet-mapping> > <servlet-name>invoker</servlet-name> > <url-pattern>/servlet/*</url-pattern> > </servlet-mapping> > > The I have login.jsp and welcome.jsp file under webapps/onjava directory. > In login.jsp, I have the following code > <form name="loginForm" method="post" action="servlet/com.onjava.login"> > ...... > </form> > > I have login.java file with package statement on top. > package com.onjava; > I compiled the code and move the login.class file into > webapps/onjava/Web-inf/classes/com/onjava directory. > > In webapps/Web-inf/web.xml file, I have the following line of code. > <?xml version="1.0" encoding="ISO-8859-1" ?> > <!DOCTYPE web-app (View Source for full doctype...)> > - <web-app> > - <servlet> > <servlet-name>login</servlet-name> > <servlet-class>com.onjava.login</servlet-class> > </servlet> > - <servlet-mapping> > <servlet-name>login</servlet-name> > <url-pattern>/servlet/login</url-pattern> > </servlet-mapping> > </web-app> > > I am able to get login.jsp by using http://localhost:8080/onjava/login.jsp. > But > when I submit it I got the HTTP status 404 - > /onjava/servlet/com.onjava.login > error. > > Anything I did wrong? > > Jim > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]