Bug 515311 - 404 when accessing Tomcat 9 in Eclipse
Summary: 404 when accessing Tomcat 9 in Eclipse
Status: RESOLVED WORKSFORME
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Elson Yuen CLA
QA Contact: Elson Yuen CLA
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2017-04-15 03:25 EDT by Mahdad Zarafshan CLA
Modified: 2018-07-13 12:39 EDT (History)
6 users (show)

See Also:


Attachments
Solution start tomcat in eclipse (139.18 KB, image/jpeg)
2018-03-29 07:58 EDT, Vincenzo Errico CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mahdad Zarafshan CLA 2017-04-15 03:25:48 EDT
I have Eclipse Neon 4.6.3 installed. I also installed Tomcat 9. I have also installed JDK 1.8 and added JAVA_HOME environment variable to the system. Tomcat starts from command prompt successfully outside Eclipse and I can access home page at http://localhost:8080/ so everything is good. When I shut down the server, and create a server inside Eclipse, using the JRE which is under my JDK 1.8, and using Tomcat 9. The server gets created successfully and a Server project also gets created. Please note that I didn't create any other web modules inside Eclipse, so the server is empty but I don't think that should be any problem. The server starts successfully and I can see no errors in console, however, when I try to access home page at http://localhost:8080/ I get this error. I googled the error and tried all the tricks to no avail. Even adding a web module to the server didn't help. Please advise on what I am missing to configure this inside Eclipse. Thanks.

HTTP Status 404 – Not Found

Type Status Report

Message /

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

Apache Tomcat/9.0.0.M19
Comment 1 Patrik Suzzi CLA 2017-06-07 05:49:20 EDT
Mahdad, can you please check the server configuration in Eclipse, and verify the Tomcat port id set to 8080?
Comment 2 Mahdad Zarafshan CLA 2017-06-07 14:28:01 EDT
Hi Patrik,

This is from server.xml under C:\Users\Mahdad\workspace\Servers\Tomcat v9.0 Server at localhost-config

Tomcat admin port 8005
HTTP/1.1 8080
AJP/1.3 8009

So, accessing http://localhost:8080 gives me 404 and http://localhost:8005 gives me:

Jun 07, 2017 11:03:29 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received
Jun 07, 2017 11:23:20 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command 'GET / HTTP/1.1' received

If you want, I can paste the whole server.xml or any other config files. Thanks.
Comment 3 Patrik Suzzi CLA 2017-06-07 16:38:28 EDT
Mahdad, thanks for the prompt response. I am raising the severity to major, so this bug is more visible to the wst.server committers. 

Could I ask you to attach the console output when tomcat is starting?  

Also, are you sure you stopped the first Tomcat, and all the other services running on port 8080, before launching the second Tomcat from inside Eclipse?
(sorry for the very basilar questions)
Comment 4 Elson Yuen CLA 2017-06-07 17:02:09 EDT
The default behaviour when starting the server from the tools is using the workspace metadata for the server path which doesn't contains the root app.  That's why the root URL of the server does not contains the home page.  

You can change the behaviour by opening up the server editor and change the Server Location field to "Use Tomcat installation". That'll change the server path to the root of the tomcat installation location and the home page should show.
Comment 5 Elson Yuen CLA 2017-06-07 17:04:32 EDT
I forgot to mention that you need to restart the server for changes to take place after you change that settings in the server editor.
Comment 6 Mahdad Zarafshan CLA 2017-06-07 17:28:43 EDT
Hi Patrik and Elson,

The issue was resolved after I changed server location to point to Tomcat installation. The default was "workspace". Now I can see the admin page. Thanks for your help. Mahdad
Comment 7 Elson Yuen CLA 2017-06-07 17:34:25 EDT
I am marking this issue as resolved based on comment #6.
Comment 8 Abhishek kalokhe CLA 2017-08-18 12:06:42 EDT
No , 
i am still getting same error
Comment 9 Anil Osta CLA 2017-10-21 14:39:16 EDT
Still I am getting the same issues, I also tried the solution suggested in comment #6. still issues is there. FYI- I am also using Tomcat 9. 
Please re-open the issue
Comment 10 Vincenzo Errico CLA 2018-03-29 07:58:09 EDT
Created attachment 273362 [details]
Solution start tomcat in eclipse
Comment 11 Vincenzo Errico CLA 2018-03-29 08:04:00 EDT
For me worked. As we can see in comment_#10, in "Server location" set "Tomcat installation" and in "Timeouts" > "Start (in seconds)" set a value major > 45sec.
My configuration: Tomcat 9.0.6 + Eclipse Oxygen 4.3.7
Comment 12 Sumit Saha CLA 2018-07-13 12:39:36 EDT
Well i don't whether this a bug or not but i have a workaround perfectly working.
Double click on the Server name under the Servers tab, in that under Server Location choose the second option ie use tomcat location and then restart the server. It should work by now.