Overclock.net banner

1 - 1 of 1 Posts

Linux Lobbyist
3,744 Posts
Discussion Starter #1
OK, I'm trying to diagnose Servlet mapping on a Apache Tomcat installation.

This is the Servlet I created just to diagnose the problem:


package com.example.test.server;

import java.util.logging.*;

import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorldServlet extends HttpServlet {

        private Logger logger = Logger.getLogger("HelloWorld");

       *  Constructor
        public HelloWorldServlet() {

        public void init() {
                logger.info("init() called.");

        public void destroy() {
                logger.info("destroy() called.");

        public void doGet(HttpServletRequest request, HttpServletResponse response) {
                logger.info("doGet(): called.");

        public void doPost(HttpServletRequest request, HttpServletResponse response) {
                logger.info("doPost(): called.");
and this is the web.xml file:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

        <!-- General description of your web application -->
        <display-name>Hello World</display-name>
        <description>Hello, world!</description>

                <description>Hello World Servlet</description>
However, pointing wget at the URI results in 404. I've successfully deployed Servlets before, so what am I missing?

It looks like Tomcat largely ignores the url-mapping tags. The Servlet is under $TOMCAT_HOME/webapps/HelloWorld. If I pass to wget, it works as expected. I find this odd, unless I am misunderstanding how the URL mapping works?
1 - 1 of 1 Posts