Reputation: 123
My web application runs fine with Eclipse & Tomcat on my desktop PC. When I uploaded the war file to the actual server, I wasn't able to access all the servlets with the following error message. Other JSP and HTML files had no problems.
The requested URL /HelloWorld/TryingServlet was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
How is this caused and how can I solve this?
Upvotes: 2
Views: 8090
Reputation: 31928
Your problem is that in your production environment tomcat is being fronted by an apache httpd which does not forward requests to tomcat for urls of the form /foobar
(without an extension). Apache doesn't know how to deal with those URLs and tries to serve them as static files from the disk. The files are not there so it tries to execute the 404 rule which is badly configured (the configured 404 file is itself missing as well - but that's another problem).
Solutions:
.do
(like struts does) so your servlet becomes /foobar.do
. You'll then need to ask your sysadmin to specify that *.do
goes to tomcat.*.jpg
, *.png
, *.css
, *.js
etcUpvotes: 1
Reputation: 181460
Try this url:
http://YOUR_IP:8080/HelloWorld.war/TryingServlet
Replace HelloWorld.war
with the actual name of your war file...
Upvotes: 1