Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 404 error: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists [duplicate]

I was following the tutorial on o7planning and got stuck at step 6:

http://o7planning.org/en/10169/java-servlet-tutorial

It's just a simple project that show HelloWorld but for some reason I keep getting 404 error. Detail:

enter image description here However the Tomcat welcome page showing properly.

Tomcat welcome page

Here solutions that I've tried so far (and they are NOT working):

Right-click project -> properties -> Project Facets -> Runtimes -> checked "Apache Tomcat v9.0" -> Apply -> finish.

Server tab -> Right-click "Tomcat v9.0..." -> properties -> switch location -> Choose "Use tomcat installation" on "Server locations" panel.

like image 972
Lê Quang Bảo Avatar asked Apr 03 '17 13:04

Lê Quang Bảo


People also ask

How do you fix the origin server did not find a current representation for the target resource?

From eclipse, you right click the project -> Run As -> Run on Server and then it worked for me.

What should be done in Tomcat error 404 the origin server did not find current representation for the target resource or is not willing to disclose?

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.


2 Answers

Problem solved, I've not added the index.html. Which is point out in the web.xml

enter image description here

Note: a project may have more than one web.xml file.

if there are another web.xml in

src/main/webapp/WEB-INF

Then you might need to add another index (this time index.jsp) to

src/main/webapp/WEB-INF/pages/

like image 70
Lê Quang Bảo Avatar answered Sep 28 '22 13:09

Lê Quang Bảo


Hope this helps. From eclipse, you right click the project -> Run As -> Run on Server and then it worked for me. I used Eclipse Jee Neon and Apache Tomcat 9.0. :)

I just removed the head portion in index.html file and it worked fine.This is the head tag in html file

like image 25
Michael Joshua Ramos Avatar answered Sep 28 '22 13:09

Michael Joshua Ramos