Tomcat 404 ошибка

I downloaded Apache Tomcat 6.0.2 And created a new server in Eclipse New -> Server Select "Tomcat v6.0 Server", Next Tomcat Installation Directory -> Where I unzipped Apache Tomcat 6.0.2 Finish T...

I downloaded Apache Tomcat 6.0.2
And created a new server in Eclipse

  1. New -> Server
  2. Select «Tomcat v6.0 Server», Next
  3. Tomcat Installation Directory -> Where I unzipped Apache Tomcat 6.0.2
  4. Finish

Then I start the server and go to http://localhost:8080/ to see if it works. And I get a 404 error.

I’ve already googled it and tried to find a solution. But none of those remedies seem to work.

Any thoughts on what the problem is?

Stu Thompson's user avatar

Stu Thompson

38.1k19 gold badges107 silver badges156 bronze badges

asked Jul 22, 2009 at 6:57

hello_world_infinity's user avatar

2

From the top of my head, I thought Eclipse started the tomcat server without anything in it, i.e. no web applications. You have to ‘run’ or actually deploy something in that Eclipse Tomcat server so you won’t get the 404s.

The fact that you do get 404 error messages indicates that Tomcat actually IS running. If you shut it down from Eclipse, you won’t get those 404’s anymore ;)

answered Jul 22, 2009 at 7:10

drvdijk's user avatar

If your wanting to see your Tomcat Server Homepage then you will need to specify the server path and deploy path. The default is set to Use workspace metadata (does not modify your Tomcat installation).

How to do it.

  1. Firstly open the Server’s view in Eclipse. (Window >> Show View >> Servers).
  2. Double click on your Tomcat Server to open the Server Overview.
  3. Then set the Server Locations to Use Tomcat installation (takes control of Tomcat installation). Save the changes.
  4. Restart your Server and then go to localhost:8080. This should open the Apache Tomcat Homepage for your server.

Hope this helps!

answered Apr 14, 2012 at 20:46

Shane Doyle's user avatar

Shane DoyleShane Doyle

1,0561 gold badge12 silver badges16 bronze badges

The error 404 appears when Tomcat can’t find the localhost.ser file.
In order to get rid of this follow these steps:
1) In Eclipse, right click on server —> Properties —> Click Switch Location —> Apply—>Ok
(This will switch the [workspace metadata] location to the installed Tomcat location.)
2) Then go back to server, double click it. This will open Overview tab. Under this tab goto —>Server Location —> Select Use Tomcat Installation combo box.

Now close it, save it and try run your server and then rerun the URL.

answered May 1, 2012 at 20:20

Sonu's user avatar

SonuSonu

511 silver badge1 bronze badge

I agree to drvdijk.

Go to «Servers» window, then select your Tomcat instance. Double.click here you will see the «overview» window. Here you can click on «Open launch configuration» to see your Tomcat arguments («Arguments» tab).

Look for the system property «-Dwtp.deploy». This directory is where your Tomcat is looking for installed web applications, i think you don’t have ROOT.war application here. Isn’t it? :-)

Hope this will help you

answered Jul 22, 2009 at 7:35

sourcerebels's user avatar

sourcerebelssourcerebels

5,1301 gold badge32 silver badges52 bronze badges

answered Jul 24, 2009 at 15:23

Titi Wangsa bin Damhore's user avatar

The problem is just as drvdijk mentioned, in order to run a webapp on tomcat from eclipse, it needs to be «deployed» to it. This can be done by right clicking the tomcat server -> add and remove

Alternatively, you can try to startup your tomcat server outside of eclipse. Go to your command line and type

  $CATALINA_HOMEbinstartup.bat          (Windows)

  $CATALINA_HOME/bin/startup.sh           (Unix)

Where $catalina_home is the directory of where you installed tomcat

answered Jan 8, 2012 at 23:41

kumikoda's user avatar

kumikodakumikoda

6446 silver badges27 bronze badges

Launch your eclipse Run as administration:
For that right click on eclipse——> run as administration.
It works.

If it not works then again do same and then follow these steps:

  1. In Eclipse, right click on server —> Properties —> Click Switch
    Location —> Apply—>Ok
    (This will switch the [workspace metadata]
    location to the installed Tomcat location.)

  2. Then go back to server, double click it. This will open Overview
    tab. Under this tab goto —>Server Location —> Select Use Tomcat
    Installation
    combo box.

Now close it, save it and try run your server and then rerun the URL.

Panther's user avatar

Panther

3,2729 gold badges26 silver badges49 bronze badges

answered Dec 16, 2016 at 9:55

Ashish Anand's user avatar

1- double click on server
2- Make Sure You have switched correctly the directory for tomcat here

Before

enter image description here

After Fix
enter image description here

3- And Even if you do #2 above you may need do this here as well !

Again here !

enter image description here

answered Dec 19, 2017 at 20:20

shareef's user avatar

shareefshareef

9,00413 gold badges58 silver badges89 bronze badges

Also, notice if you have a duplicated WEB-INF in your path. Sometimes after update a maven project you may have this issue and Tomcat points to an empty folder.

Try to use Tomcat 9 Instead of Tomcat 10

Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 without changes. Java EE based applications designed for Tomcat 9 and earlier may be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat will automatically convert them to Jakarta EE and copy them to the webapps directory. This conversion is performed using the Apache Tomcat migration tool for Jakarta EE tool which is also available as a separate download for off-line use.

Eric Aya's user avatar

Eric Aya

69.1k35 gold badges179 silver badges250 bronze badges

answered Jul 6, 2022 at 18:04

стасевич's user avatar

стасевичстасевич

2282 silver badges9 bronze badges

I downloaded Apache Tomcat 6.0.2
And created a new server in Eclipse

  1. New -> Server
  2. Select «Tomcat v6.0 Server», Next
  3. Tomcat Installation Directory -> Where I unzipped Apache Tomcat 6.0.2
  4. Finish

Then I start the server and go to http://localhost:8080/ to see if it works. And I get a 404 error.

I’ve already googled it and tried to find a solution. But none of those remedies seem to work.

Any thoughts on what the problem is?

Stu Thompson's user avatar

Stu Thompson

38.1k19 gold badges107 silver badges156 bronze badges

asked Jul 22, 2009 at 6:57

hello_world_infinity's user avatar

2

From the top of my head, I thought Eclipse started the tomcat server without anything in it, i.e. no web applications. You have to ‘run’ or actually deploy something in that Eclipse Tomcat server so you won’t get the 404s.

The fact that you do get 404 error messages indicates that Tomcat actually IS running. If you shut it down from Eclipse, you won’t get those 404’s anymore ;)

answered Jul 22, 2009 at 7:10

drvdijk's user avatar

If your wanting to see your Tomcat Server Homepage then you will need to specify the server path and deploy path. The default is set to Use workspace metadata (does not modify your Tomcat installation).

How to do it.

  1. Firstly open the Server’s view in Eclipse. (Window >> Show View >> Servers).
  2. Double click on your Tomcat Server to open the Server Overview.
  3. Then set the Server Locations to Use Tomcat installation (takes control of Tomcat installation). Save the changes.
  4. Restart your Server and then go to localhost:8080. This should open the Apache Tomcat Homepage for your server.

Hope this helps!

answered Apr 14, 2012 at 20:46

Shane Doyle's user avatar

Shane DoyleShane Doyle

1,0561 gold badge12 silver badges16 bronze badges

The error 404 appears when Tomcat can’t find the localhost.ser file.
In order to get rid of this follow these steps:
1) In Eclipse, right click on server —> Properties —> Click Switch Location —> Apply—>Ok
(This will switch the [workspace metadata] location to the installed Tomcat location.)
2) Then go back to server, double click it. This will open Overview tab. Under this tab goto —>Server Location —> Select Use Tomcat Installation combo box.

Now close it, save it and try run your server and then rerun the URL.

answered May 1, 2012 at 20:20

Sonu's user avatar

SonuSonu

511 silver badge1 bronze badge

I agree to drvdijk.

Go to «Servers» window, then select your Tomcat instance. Double.click here you will see the «overview» window. Here you can click on «Open launch configuration» to see your Tomcat arguments («Arguments» tab).

Look for the system property «-Dwtp.deploy». This directory is where your Tomcat is looking for installed web applications, i think you don’t have ROOT.war application here. Isn’t it? :-)

Hope this will help you

answered Jul 22, 2009 at 7:35

sourcerebels's user avatar

sourcerebelssourcerebels

5,1301 gold badge32 silver badges52 bronze badges

answered Jul 24, 2009 at 15:23

Titi Wangsa bin Damhore's user avatar

The problem is just as drvdijk mentioned, in order to run a webapp on tomcat from eclipse, it needs to be «deployed» to it. This can be done by right clicking the tomcat server -> add and remove

Alternatively, you can try to startup your tomcat server outside of eclipse. Go to your command line and type

  $CATALINA_HOMEbinstartup.bat          (Windows)

  $CATALINA_HOME/bin/startup.sh           (Unix)

Where $catalina_home is the directory of where you installed tomcat

answered Jan 8, 2012 at 23:41

kumikoda's user avatar

kumikodakumikoda

6446 silver badges27 bronze badges

Launch your eclipse Run as administration:
For that right click on eclipse——> run as administration.
It works.

If it not works then again do same and then follow these steps:

  1. In Eclipse, right click on server —> Properties —> Click Switch
    Location —> Apply—>Ok
    (This will switch the [workspace metadata]
    location to the installed Tomcat location.)

  2. Then go back to server, double click it. This will open Overview
    tab. Under this tab goto —>Server Location —> Select Use Tomcat
    Installation
    combo box.

Now close it, save it and try run your server and then rerun the URL.

Panther's user avatar

Panther

3,2729 gold badges26 silver badges49 bronze badges

answered Dec 16, 2016 at 9:55

Ashish Anand's user avatar

1- double click on server
2- Make Sure You have switched correctly the directory for tomcat here

Before

enter image description here

After Fix
enter image description here

3- And Even if you do #2 above you may need do this here as well !

Again here !

enter image description here

answered Dec 19, 2017 at 20:20

shareef's user avatar

shareefshareef

9,00413 gold badges58 silver badges89 bronze badges

Also, notice if you have a duplicated WEB-INF in your path. Sometimes after update a maven project you may have this issue and Tomcat points to an empty folder.

Try to use Tomcat 9 Instead of Tomcat 10

Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 without changes. Java EE based applications designed for Tomcat 9 and earlier may be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat will automatically convert them to Jakarta EE and copy them to the webapps directory. This conversion is performed using the Apache Tomcat migration tool for Jakarta EE tool which is also available as a separate download for off-line use.

Eric Aya's user avatar

Eric Aya

69.1k35 gold badges179 silver badges250 bronze badges

answered Jul 6, 2022 at 18:04

стасевич's user avatar

стасевичстасевич

2282 silver badges9 bronze badges

  1. HowTo
  2. Java Howtos
  3. Tomcat 404 Error
  1. Tomcat 404 Error in Java
  2. Tomcat 404 Error in Eclipse

Tomcat 404 Error

This tutorial demonstrates how to troubleshoot the Tomcat 404 error in Java.

Tomcat 404 Error in Java

While using the apache Tomcat server for web development in Java, the most common error is the HTTP Status 404. This error means the server cannot find the required resource.

The required file can be anything like HTML, Image Resource or JSP.

Most of the time, the error occurs when the required reference is not present or is referenced incorrectly. The error looks like this:

Tomcat 404 Error

There are three main reasons for this error in Apache Tomcat.

  1. The URL is Case Sensitive

    The Tomcat URLs are case sensitive, so whenever you are trying to write the URL by yourself, make sure that it is also correct in its case. Otherwise, it will throw the 404 status error.

  2. The Servlets Do Not Handle the URL

    The @Webservlet() is also used to handle the URL/demo, but when requesting the URL, it can be URL/this_demo, which is a different reference. This can be fixed by using the URL mapping and referencing the URL correctly.

    See example:

    @WebServlet("/demo")
    public class Demo extends HttpServlet {
    // Your code here.
    }
    

    Now, if the website requests the URL this_demo, we can solve it by changing the demo to this_demo in the URL mapping.

  3. Resource Forward by Servlets Does Not Exist

    When the resource forwarded by servlets does not exist, the Tomcat will throw a 404 error. Make sure the resource forwarded exists and the name of that resource is correct.

    For example, if we are referencing the DemoForm.jsp but the real name of that resource is Demo_Form.jsp, it will throw the 404 status error. We can change the DemoForm.jsp to Demo_Form.jsp to solve this error.

    See example:

    String Demo_Form= "frontend/Demo_Form.jsp";
    RequestDispatcher Request_Dispatcher = request.getRequestDispatcher(Demo_Form);
    Request_Dispatcher.forward(request, response);
    

Tomcat 404 Error in Eclipse

While working with Tomcat in Eclipse IDE, the same 404 error can occur even if we have managed all the solutions above. Sometimes, even if the Tomcat starts, the browser will throw the 404 error while working with Eclipse IDE.

This error is because Tomcat is not configured correctly in the Eclipse IDE. To solve this issue in Eclipse, follow the steps below.

  • Make sure Tomcat is downloaded and extracted.
  • Open the Eclipse IDE. Make sure you are using the EE version of Eclipse.
  • Go to the Servers tab in Eclipse, and if you see no Tomcat server, click create a new server. Or go to the Window menu, then Preferences and then Server and Add New.

    Tomcat Server Tab

    Tomcat Server Add

  • Select your version of Tomcat from the Apache folder on the page and click Next.

    Tomcat Server Add Apache

  • Click Browse and select your Tomcat directory. The installed JRE is okay if it works; otherwise, add the latest version. Click Next.

    Tomcat Server Add Path

  • Select your project and click Add and then Finish. A Tomcat server will be added to the Servers tab.

    Tomcat Server Added

  • Double click the Tomcat Server in the Servers tab, and a page will open. Under the Server Locations, select Use Tomcat Installation.
  • Save the configuration by Ctrl+S.
  • Restart the server, right-click on the server name in the Servers tab and click Restart.

    Tomcat Restart

  • Now the server works perfectly.

    Tomcat Started

Sheeraz Gul avatar
Sheeraz Gul avatar

Sheeraz is a Doctorate fellow in Computer Science at Northwestern Polytechnical University, Xian, China. He has 7 years of Software Development experience in AI, Web, Database, and Desktop technologies. He writes tutorials in Java, PHP, Python, GoLang, R, etc., to help beginners learn the field of Computer Science.

LinkedIn
Facebook

Related Article — Java Error

  • Java.Lang.VerifyError: Bad Type on Operand Stack
  • Error Opening Registry Key ‘Software JavaSoft Java Runtime Environment.3’ in Java
  • Identifier Expected Error in Java
  • Error: Class, Interface, or Enum Expected in Java
  • Unreported Exception Must Be Caught or Declared to Be Thrown
  • Java.Lang.OutOfMemoryError: Unable to Create New Native ThreadEzoic
  • Details
    Written by  
    Last Updated on 05 November 2019   |   Print  Email

    In Java web development with Tomcat, it’s very often that you get HTTP 404 error like this:

    tomcat-error-404

    The error code is HTTP 404 (not found) and the description is:

    The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

    This error means the server could not find the requested resource (JSP, HTML, images…) and returns HTTP status code 404. Most of the time, you can fix this error by correcting the URL. However, sometimes it’s not easy like that, making it is an annoying error.

    Here I suggest some possible reasons and how to fix the error HTTP 404 in Java web development with Tomcat.

     

    1. The URL is not handled by any Java servlets

    You need to check URL mapping in your servlet classes to make sure the requested URL is actually handled by a servlet. For example:

    @WebServlet("/view_book")
    public class ViewBookServlet extends HttpServlet {
    ...
    }

    This servlet handles the URL /view_book. If the request URL is /view_books the server will raise HTTP 404 error. You can fix by either correcting the URL or correcting the URL mapping in the @WebServlet annotation.

    In older Java web application, you have to check the web deployment descriptor file web.xml because a Java servlet can be mapped to URL via XML like this:

    <servlet-mapping>
        <servlet-name>ViewBookServlet</servlet-name>
        <url-pattern>/view_book</url-pattern>
    </servlet-mapping>

     

    2. Java servlet forwarding to a resource that does not exist

    In this case, the requested URL is handled by a Java servlet, but code in the servlet forwards to a resource (JSP, HTML…) which does not exist, as shown in the following screenshot:

    tomcat-error-404-forwarding

    The code in the servlet class would look like this:

    String registerForm = "frontend/registerform.jsp";
    RequestDispatcher dispatcher = request.getRequestDispatcher(registerForm);
    dispatcher.forward(request, response);

    You can fix by correcting the forward path in the servlet, and make sure that the forwarded resource does actually exist in the given path.

     

    3. URL is case-sensitive

    Note that Tomcat treats URL as case-sensitive, for instance /Register is different than /register. So you need to check and use correct case for the letters in request URL.

    Also pay attention to the webapp name in the URL, for instance http://localhost:8080/BookstoreWebsite/ is different than http://localhost:8080/BookStoreWebsite/

    TIP: in Eclipse, you can right click on the project, then click Run As > Run on Server, the IDE will always use the correct name of the web application.

    Finally, you should not let the user see the raw HTTP 404 error page rendered by the server. Instead, you should design your own user-friendly 404 error page – follow this tutorial: How to Handle Error for Java web applications.

    You can also watch the video version below:

     

    Other Java Servlet Tutorials:

    • Java Servlet Quick Start for beginners (XML)
    • Java Servlet for beginners (annotations)
    • Java Servlet and JSP Hello World Tutorial with Eclipse, Maven and Apache Tomcat
    • Handling HTML form data with Java Servlet
    • Java File Download Servlet Example

    About the Author:

    Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.

    Add comment

    how to solve Apache Tomcat 404 Page not found error?

    Today I was running Apache Tomcat from Eclipse and while accessing URL http://localhost:8080 found HTTP Status 404 – Not Found error.

    The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

    Do you have any of below questions?

    • Tomcat starts but doesn’t display webpage
    • Can’t connect to Tomcat even though it’s running
    • How to Solve Common Tomcat Problems
    • Can’t connect to localhost via browser. Can ping localhost
    • How to open tomcat home page in browser
    • localhost 8080 not working for tomcat

    For all above types of issues,  you are at right place.

    I’ve setup Apache Tomcat by following detailed steps using in-depth tutorial.

    Steps worked perfectly fine but as I didn’t have any projects added to tomcat webapps folder it threw 404 error for me.

    If you also face 404 Page not found error then try following below steps:

    Step-1

    • Go to Eclipse IDE
    • Click on Servers Tab
    • Double click on Tomcat v9.0 Server at localhost

    Tomcat Click on Servers Tab and then double click on Tomcat Server

    Step-2

    • New Apache Tomcat configuration page will open
    • Go to Server Location section
    • Select Use Tomcat installation (takes control of Tomcat installation)

    Apache Tomcat Server Location Change to Fix 404 Error

    Step-3

    • Save configuration
    • Restart Server by right clicking on tomcat server and click Restart
    • Visit http://localhost:8080 again and now you should see working tomcat page

    Localhost 8080 - 404 not found apache tomcat error resolved

    I hope this tutorial works well for you. Happy coding and keep visiting.

    This tutorial works for Apache Tomcat 10.0 too.

    Apache Tomcat 10 running fine on Mac


    Join the Discussion

    If you liked this article, then please share it on social media. Still have any questions about an article, leave us a comment.

    Share:

    I’m an Engineer by profession, Blogger by passion & Founder of Crunchify, LLC, the largest free blogging & technical resource site for beginners. Love SEO, SaaS, #webperf, WordPress, Java. With over 16 millions+ pageviews/month, Crunchify has changed the life of over thousands of individual around the globe teaching Java & Web Tech for FREE.

    Reader Interactions

    Problem

    After restarting the Tomcat Application server the HTTP Status 404 error occurs in IBM Rational Project Conductor.

    Symptom

    Apache Tomcat — Error report
    HTTP Status 404 — Servlet equinoxbridgeservlet is not available
    type Status report
    message Servlet equinoxbridgeservlet is not available
    description The requested resource (Servlet equinoxbridgeservlet is not available) is not available

    Cause

    The {$JazzInstallDir}Tomcatwebappsjazz directory may be corrupted.

    Resolving The Problem

    Clean out the {$JazzInstallDir}Tomcatwebappsjazz Directory:

    1. Make sure that the right jazz.war file is present in the {$JazzInstallDir}Tomcatwebapps directory
    2. Stop the Tomcat application server
    3. Rename the jazz folder found in {$JazzInstallDir}Tomcatwebapps to jazz_old
    4. Move the jazz_old folder to a location, for backup purposes
    5. Restart the Tomcat application server

    At this point the Tomcat application server should re-deploy the jazz.war file. This will create a new jazz Directory.

    If the problem persists, check available room on the drive on which the Tomcat server is installed. It might be a disk space issue.

    [{«Product»:{«code»:»SSN2WR»,»label»:»Rational Project Conductor»},»Business Unit»:{«code»:»BU053″,»label»:»Cloud & Data Platform»},»Component»:»Team Server»,»Platform»:[{«code»:»PF033″,»label»:»Windows»}],»Version»:»1.0.0.1″,»Edition»:»»,»Line of Business»:{«code»:»LOB45″,»label»:»Automation»}}]

    Понравилась статья? Поделить с друзьями:
  • Tomb raider legend fatal error
  • Tomb raider legend error out of table range
  • Tomb raider anniversary error out of table range
  • Tomahawk как изменить температуру автозапуска
  • Tom clancy s splinter cell conviction как изменить язык