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

  • SEARCH
  • Home
  • 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 8174217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:23:45+00:00 2026-06-06T22:23:45+00:00

The problem : My index.jsp with web.xml keeps going into HTTP 404 and 500

  • 0

The problem : My index.jsp with web.xml keeps going into HTTP 404 and 500

I’m using Tomcat6 .

This is from index.jsp :

  <legend>Registration</legend>
  <form action="./register"> <%-- Address from web.xml  --%>
    First name: <input type="text" name="firstName"><br>
    Last name: <input type="text" name="lastName"><br>
    <input type="submit" value="Register">
  </form>

When I’m in Registration :

enter image description here

and I hit the name and last-name , I go into 404 , the message :

HTTP Status 404 – Servlet RegistrationServlet is not available

type Status report

message Servlet RegistrationServlet is not available

description The requested resource (Servlet RegistrationServlet is not available) is not available.

Apache Tomcat/6.0.35

What do you think it the cause for that error ?

The class RegistrationServlet is under the file RegistrationServlet.java in the folder src/coreservlets/

I checked web.xml but it seems to be okay , but here it is (if it would be helpful):

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
  <servlet>
    <servlet-name>ShowBalance</servlet-name>
    <servlet-class>coreservlets.ShowBalance</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ShowBalance</servlet-name>
    <url-pattern>/show-balance</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>RandomNumberServlet</servlet-name>
    <servlet-class>coreservlets.RandomNumberServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>RandomNumberServlet</servlet-name>
    <url-pattern>/random-number</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>RegistrationServlet</servlet-name>
    <servlet-class>coreservlets.RegistrationServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>RegistrationServlet</servlet-name>
    <url-pattern>/register</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>PrimeServlet</servlet-name>
    <servlet-class>coreservlets.PrimeServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>PrimeServlet</servlet-name>
    <url-pattern>/prime</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

I’ve been trying to fix this little culprit for the last two days but nothing , any help would be much appreciated .

EDIT:

As requested , here is RegistrationServlet

package coreservlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RegistrationServlet extends HttpServlet {

    private static final long serialVersionUID = 1L;

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        HttpSession session = request.getSession();
        synchronized (session) {
            NameBean nameBean = (NameBean) session.getAttribute("name");
            if (nameBean == null) {
                nameBean = new NameBean();
                session.setAttribute("name", nameBean);
            }
            nameBean.setFirstName(request.getParameter("firstName"));
            nameBean.setLastName(request.getParameter("lastName"));
            String address = "/WEB-INF/mvc-sharing/ShowName.jsp";
            RequestDispatcher dispatcher = request
                    .getRequestDispatcher(address);
            dispatcher.forward(request, response);
        }
    }
}

Also here is the project tree :

enter image description here

  • 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-06-06T22:23:46+00:00Added an answer on June 6, 2026 at 10:23 pm

    Your URL is completely fine. If the URL was wrong, you would have gotten a 404 message like follows:

    Requested resource register is not available

    But you instead got

    Servlet RegistrationServlet is not available

    This means that the servlet was found, but that it couldn’t be executed because its construction and initialization failed with an exception. Under Tomcat’s covers, basically one of the following steps has failed:

    Servlet servlet = new RegistrationServlet();
    servlet.init(servletConfig);
    servlet.init();
    

    You need to read the server logs for this exception and then fix the code accordingly.


    Whilst your URL is completely fine, it’s error prone to changes in the context. You’d rather like to specify a domain-relative URL instead:

    <form action="${pageContext.request.contextPath}/register">
    

    See also this related answer: Browser can't access/find relative resources like CSS, images and links when calling a Servlet which forwards to a JSP

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

Sidebar

Related Questions

in web.xml i set my welcome file to a jsp within web.xml <welcome-file>WEB-INF/index.jsp</welcome-file> inside
I am implementing a Restful Web Service using Jersey. I want to show index.jsp
Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>
Basically my problem is with the page at http://wiki.diablocommunity.com/index.php?title=Tristram_Cathedral Please see the screen shots
before reading my problem this work in a normal dynamic web project i create
Here it goes: I am refreshing a page named index.jsp via this <head> <meta
I have index.jsp from which I get the parameters to servlet LoginServlet.java The servlet
I want to call my web site like: http://localhost:8080/?co=grav When doing this the authentication
I'm using MVC and want to put my JSP pages in WEB-INF to avoid
I am creating a simple web application using servlets and JSP. I am implementing

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.