I am using a web application deployed in Apache Tomcat webserver where I am facing an issue basically getting HTTP Status 404 No Such File or Directory. I can understand the following message as follows –
HTTP Status 404 – /s2j-main.jsp
In this scenario the web container searches for the file (s2j-main.jsp) in the top web deployment folder. For example if the web container root is a folder s2j, it will search in webapps/s2j folder for Tomcat. However, if the error comes as
HTTP Status 404 – s2j-main.jsp (minus the slash /) In which path exactly is the webcontainer expecting the resource (s2j-main.jsp) to be?
Tomcat has a ROOT webapp under
/webapps/ROOTAssume you have a jsp s2j-main.jsp placed at
/webapps/ROOT/s2j-main.jsp, then this will be accessible ashttp://<url:port>/s2j-main.jspIf you have your own webapp named s2j and it is placed at
/webapps/s2j, then any JSP under this will by default be accessible athttp://<url:port>/s2j/s2j-main.jspNote – the name of the webapp becomes part of the URL unless you have defined a
Contextinserver.xmlwith a path as “/”Only then does s2j become the root web application.
Now as you are seeing 404s on /s2j-main.jsp, it is because of either of the above, you’re not placed it in the actual ROOT or you are trying the incorrect URL