I have installed Eclipse and Tomcat 7. The error is that when I run Tomcat from Eclipse it starts, but after that, when I open localhost:8080
in Google Chrome I get HTTP Error 404()
. How can I solve this, please?

- 16,038
- 10
- 74
- 104

- 727
- 6
- 10
- 27
-
Do you see any errors in server log/console? – prashanth Jan 18 '13 at 07:02
-
1What version of Eclipse? – Gopinagh.R Jan 18 '13 at 07:35
8 Answers
First, stop your Tomcat, then double click your server, click Server Locations
and check Use Tomcat Installation (takes control of Tomcat installation)
.

- 5,488
- 10
- 51
- 76

- 1,900
- 18
- 17
-
3I have selected that option. http://localhost:8080 address is showing tomcat homepage, but my project URL http://localhost:8080/web1/WEB-INF/index.jsp or http://localhost:8080/web1/ is showing 404 error – partho Jul 17 '16 at 03:33
It is because there is no default ROOT web application. When you create some web app and deploy it to Tomcat using Eclipse, then you will be able to access it with the URL in the form of
http://localhost:8080/YourWebAppName
where YourWebAppName is some name you give to your web app (the so called application context path).
Quote from Jetty Documentation Wiki (emphasis mine):
The context path is the prefix of a URL path that is used to select the web application to which an incoming request is routed. Typically a URL in a Java servlet server is of the format
http://hostname.com/contextPath/servletPath/pathInfo
, where each of the path elements may be zero or more / separated elements. If there is no context path, the context is referred to as the root context.
If you still want the default app which is accessed with the URL of the form
http://localhost:8080
or if you change the default 8080 port to 80, then just
http://localhost
i.e. without application context path read the following (quote from Tutorial: Installing Tomcat 7 and Using it with Eclipse, emphasis mine):
Copy the ROOT (default) Web app into Eclipse. Eclipse forgets to copy the default apps (ROOT, examples, docs, etc.) when it creates a Tomcat folder inside the Eclipse workspace. Go to C:\apache-tomcat-7.0.34\webapps and copy the ROOT folder. Then go to your Eclipse workspace, go to the .metadata folder, and search for "wtpwebapps". You should find something like
C:\your-eclipse-workspace-location\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
(or.../tmp1/wtpwebapps
if you already had another server registered in Eclipse). Go to thewtpwebapps
folder and paste ROOT (say "yes" if asked if you want to merge/replace folders/files). Then reloadhttp://localhost/
to see the Tomcat welcome page.

- 16,038
- 10
- 74
- 104
-
-
1
-
1
-
3
-
@informatik01 Can you please take a look https://stackoverflow.com/questions/70117462/http-status-500-internal-server-not-responding – Encipher Nov 26 '21 at 07:44
Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace. Go to C:\apache-tomcat-7.0.34\webapps, R-click on the ROOT folder and copy it. Then go to your Eclipse workspace, go to the .metadata folder, and search for "wtpwebapps". You should find something like your-eclipse-workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps (or .../tmp1/wtpwebapps if you already had another server registered in Eclipse). Go to the wtpwebapps folder, R-click, and paste ROOT (say "yes" if asked if you want to merge/replace folders/files). Then reload http://localhost/ to see the Tomcat welcome page.

- 341
- 4
- 2
Check the server configuration and folders' routes:
Open servers view (Window -> Open view... -> Others... -> Search for 'servers'.
Right click on server (mine is Tomcat v6.0) -> properties -> Click on 'Swicth Location' (check that location's like /servers...
Double click on the server. This will open a new servers page. In the 'Servers Locations' area, check the 'Use Tomcat Installation (takes control of Tomcat Installation)' option.
Restart your server.
Enjoy!

- 121
- 1
- 12
-
Can you please take a look https://stackoverflow.com/questions/70117462/http-status-500-internal-server-not-responding – Encipher Nov 26 '21 at 07:43
-
Hi @Encipher I've read that question but it has already been answered. Sorry I don't understand what I should do about it. – George Fandango Nov 29 '21 at 08:19
If you changed the location, using option 'Use custom location (does not modify Tomcat installation)' and the deployed directory is "wtpwebapps" then you'll have to:
- Swtich Location from [workspace metadata] to /Servers/Tomcat v...., click Apply, OK.
- Retart server and if you find 404 error message than the server is working, it just doesn't have the startup file at the web-server location you have chosen. If you traverse to that location, you'll find a bunch of directories that was created. One of which is wtpwebapps, under which there is ROOT. This is your web-server's directory. You will need to go back to installed Tomcat directory and copy the content of <tomcat's installed dir>/web-apps/ROOT to your wtpwebapps. Restart the webserver and you should see the tomcat default page.
- For Server Status, Manager Apps and Host Manager to work, you'll have to copy other subdirectories from <tomcat's installed dir>/webapps (ie. docs, examples, host-manager, manager) to your "webapps" (NOT the wtpwebapps) directory.
- Edit the '<your web directory>/conf/tomcat-users.xml' and enter something like:
-
Then edit the '<your web directory>/conf/server.xml', add the attribute:
readonly="true"
into the <Resource/> key of the <GlobalNamingResources/> group. - Restart the server and try to login with the configured credentials.
<role rolename="manager-gui"/> <role rolename="manager-status"/> <role rolename="manager-jmx"/> <role rolename="manager-script"/> <role rolename="admin-gui"/> <role rolename="admin"/> <user username="admin" password="yourpassword" roles="admin, admin-gui, manager-gui"/>
NOTE: if you change the server configuration, say if you like to compare the default configuration (use tomcat installation directory) and the 'new directory', when switching back to the 'new directory' this 'tomcat-users.xml' will be overwritten by the default file, so SAVE THE CONTENT OF THIS FILE somewhere before doing that, then copy it back. If you only give the the username "admin" role, you will be prompted of help messages. It says: you should not grant the admin-gui, or manager-gui role the 'manager-jmx' and 'manager-script' roles.

- 31
- 2
- Click on Window > Show view > Server OR right click on the server in "Servers" view, select "Properties".
- OR Open the Overview screen for the server by double clicking it.
- In the Server locations tab , select "Use Tomcat location".
- Save the configurations and restart the Server.
This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse.

- 2,471
- 2
- 19
- 24
-
Can you please take a look https://stackoverflow.com/questions/70117858/http-404-after-following-all-the-required-path-and-instruction – Encipher Nov 26 '21 at 07:41
Another way to fix this would be to go to the properties of the server on eclipse (right click on server -> properties) In general tab you would see location as workspace.metadata. Click on switch location.
I had this or a similar problem after installing Tomcat.
The other answers didn't quite work, but got me on the right path. I answered this at https://stackoverflow.com/a/20762179/3128838 after discovering a YouTube video showing the exact problem I was having.

- 1
- 1

- 121
- 2
- 3