Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6843077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:12:09+00:00 2026-05-27T00:12:09+00:00

I have the following servlet coded in /src/main/java/examples/web/SimpleServlet.java : package examples.web; import java.io.IOException; import

  • 0

I have the following servlet coded in /src/main/java/examples/web/SimpleServlet.java:

package examples.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class SimpleServlet extends HttpServlet {
    public void goGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
        PrintWriter writer = res.getWriter();
        writer.println("SimpleServlet Executed!");
        writer.flush();
        writer.close();
    }
}

And the following web.xml defined in src/main/webapp/WEB-INF/web.xml:

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

<web-app>
  <display-name>Archetype Created Web Application</display-name>
  <servlet>
    <servlet-name>SimpleServlet</servlet-name>
    <servlet-class>examples.web.SimpleServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>SimpleServlet</servlet-name>
    <url-pattern>/simpleservlet</url-pattern>
  </servlet-mapping>
</web-app>

And the following pom.xml defined in /pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>examples.web</groupId>
  <artifactId>simple-webapp</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>simple-webapp Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>simple-webapp</finalName>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
        </plugin>
    </plugins>
  </build>
</project>

When I run mvn jetty:run I get output indicating that everything is working correctly. When I load localhost:8080/simple-webapp I am served src/main/webapp/index.jsp, so I know Jetty is at least partially working.

And now for the question: Although I am able to get to index.jsp, I cannot get to /simple-webapp/SimpleServlet — I just get a 404 error from Jetty. Because of my configuration in web.xml, I was expecting to see SimpleServlet Executed! from SimpleServlet. What am I doing wrong?

Here is the relevant output from mvn jetty:run:

[INFO] Configuring Jetty for project: simple-webapp Maven Webapp
[INFO] Webapp source directory = C:\Users\Ken\Workspace\Eclipse\Maven\simple-webapp\src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = C:\Users\Ken\Workspace\Eclipse\Maven\simple-webapp\target\classes
2011-11-23 16:59:56.220:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
[INFO] Context path = /simple-webapp
[INFO] Tmp directory =  determined at runtime
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = C:\Users\Ken\Workspace\Eclipse\Maven\simple-webapp\src\main\webapp\WEB-INF\web.xml
[INFO] Webapp directory = C:\Users\Ken\Workspace\Eclipse\Maven\simple-webapp\src\main\webapp
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:12:10+00:00Added an answer on May 27, 2026 at 12:12 am

    The URLs are case-sensitive. The defined URL pattern does not match the value that you are requesting:

    <url-pattern>/simpleservlet</url-pattern>
    

    Try http://localhost:8080/simple-webapp/simpleservlet (lowercase servlet name).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following scala code: package dummy import javax.servlet.http.{HttpServlet, HttpServletRequest => HSReq, HttpServletResponse
I have the following code package myPackage; import org.neo4j.graphdb; import org.neo4j.kernel.EmbeddedGraphDatabase; public class dbServlet
I have the following environment: Tomcat 5.5.30 Java 6 JAX-WS RI 2.1 My main
I have following file upload code: package net.viralpatel.contact.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller;
I have following situation. A main table and many other tables linked together with
If I have the following code in a servlet: Properties p = new Properties();
I have the following code: String table; private DB.ConnectMAS mas=new DB.ConnectMAS(); java.sql.ResultSet rs1 =
I have the following servlet code public void doPost(HttpServletRequest request, HttpServletResponse response){ Backup bup
I have an application web.xml with the following entry: <error-page> <error-code>404</error-code> <location>/system_files/error/p_notfound.jsp</location> </error-page> However,
I have a java servlet that throws a custom error 403 (Forbidden) when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.