Paul Toyn wrote:
The following is a snippet from the Jakarta-Tomcat configuration and
testing documentation:
Once you compile HelloServlet.java, put HelloServlet.class in
install_dir/webapps/ROOT/WEB-INF/classes. After compiling the code,
access the servlet with the URL http://localhost/servlet/HelloServlet
... You should get a simple HTML page that says "Hello". If this URL
fails but the test of the server itself succeeded, you probably put the
class file in the wrong directory.
I've followed the example and everything is working up to the point
above. I compiled the java code and it compiled without a hitch, but I
do get a 404 error when I try the URL. The test of the server did
succeed. I placed the class file into the folder as indicated. Is the
documentation correct? Where does the folder "servlet" get involved?
What am I doing wrong?
Is this with Tomcat 4.1.12? If so, it's because the "invoker" (the
servlet mapped to the "/servlet/*" path) is disabled by default starting
with this version due to security concerns. See the release notes for
details.
In general, you should use explicit mappings for all servlets instead
of using the "invoker". Add this to the web.xml file for the application
(e.g. webapps/ROOT/WEB-INF/web.xml for the Tomcat default application):
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
...
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello/*</url-pattern>
</servlet-mapping>
After restarting the web container (Tomcat), you can use a URL like
this to invoke it:
http://localhost:8080/hello
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
JavaServer Pages http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com