user496934
user496934

Reputation: 4020

Path of web applications

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?

Upvotes: 0

Views: 95

Answers (1)

JoseK
JoseK

Reputation: 31371

Tomcat has a ROOT webapp under /webapps/ROOT Assume you have a jsp s2j-main.jsp placed at /webapps/ROOT/s2j-main.jsp, then this will be accessible as

http://<url:port>/s2j-main.jsp

If you have your own webapp named s2j and it is placed at /webapps/s2j, then any JSP under this will by default be accessible at

http://<url:port>/s2j/s2j-main.jsp

Note - the name of the webapp becomes part of the URL unless you have defined a Context in server.xml with 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

Upvotes: 1

Related Questions