aspose file tools*
The moose likes Tomcat and the fly likes Where does the server look for stuff? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Where does the server look for stuff?" Watch "Where does the server look for stuff?" New topic
Author

Where does the server look for stuff?

Allen Williams
Ranch Hand

Joined: Sep 04, 2006
Posts: 136
I have all my web stuff in /var/www/webapps, with a subdirectory "smsinfo" for my web app (i. e., /var/www/webapps/smsinfo). I just recently moved a set of jsp's that are only accessed by members into a subdirectory called (oddly enough;) "members", so globally accessible html's and jsp's are in /var/www/webapps/smsinfo, and all others are in /var/www/webapps/smsinfo/members (this was so I could implement an authentication filter on those jsp's). Before, every worked fine. Afterwards, most things work fine... There are some included files that are included in everything, and some only included in members pages, etc. that all find each other now, except for one problem. Obviously, the login page is in the globally accessible area, and in the members area there is a logout.jsp, which is brick simple. The entire body is here:

Note again that this is in /var/www/webapps/smsinfo/members. Everytime it runs, I get


HTTP Status 404 - /smsinfo/login.jsp

type Status report

message /smsinfo/login.jsp

description The requested resource (/smsinfo/login.jsp) is not available.
Apache Tomcat/5.5.17


I've tried referencing /login.jsp, /smsinfo/login.jsp, login.jsp, and the above, ../login.jsp, all giving the same error, and all my other cross-directory references work fine. This must be something brain-dead simple that I just can't see.

Could it have something to do with invalidating the session? Also, I just noticed something. I don't have to set the user to "null" if I'm invalidating the session, do I? This is one of the first jsp's I wrote.
TIA


-------<br />Thanks & regards,<br />anw
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Java application servers don't see things in terms of directories and files.
They see webapps.

The structure of a webapp is documented in the servlet spec (link in my signature).

With Tomcat, you can either deploy an app by placing a war archive or a properly structured directory tree under the webapps directory; or you can specifiy the location of a war file or directory tree in a Context entry.

The context entry can be made in the tomcat/conf/server.xml file or as a context fragment file in tomcat/conf/Catalina/localhost.

If you're connecting tomcat to a webserver such as Apache httpd, there will be additional configuration needed.

In short, the answer to this question depends on how your server was set up.
If you can't contact the person who set it up, you may need to start looking through the config files to see how things work.


Since this is not really a JSP specific question, I'm moving the topic to our Apache/Tomcat forum.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Allen Williams
Ranch Hand

Joined: Sep 04, 2006
Posts: 136
I was the one who set it up, and it doesn't have anything to do with jars, wars, class directories, and the WEB-INF directory structure, which is all working just fine. Yes, it is front-ended with Apache, and the root is /var/www/webapps/smsinfo. I had all the jsp's and htm's in the root directory, and just added a subdirectory and moved some into it, and now it I'm getting the error (as I stated)


HTTP Status 404 - /smsinfo/login.jsp

type Status report

message /smsinfo/login.jsp

description The requested resource (/smsinfo/login.jsp) is not available.
Apache Tomcat/5.5.17

where it is saying /smsinfo/login.jsp is not available, but it has always been in the same place, /var/www/webapps/smsinfo, the root directory for this site.

The login.jsp file, as stated above was not moved, but the logout.jsp file, listed above, was.
Allen Williams
Ranch Hand

Joined: Sep 04, 2006
Posts: 136
Also, the error message references the SAME uri (/smsinfo/login.jsp) regardless of how I reference it in logout.jsp. I have now tried changing the order of the call to invalidate, with no difference.
Allen Williams
Ranch Hand

Joined: Sep 04, 2006
Posts: 136
Well, I finally got it fixed, but by trial-and-error. I still have no clue how to figure out how the server looks for stuff.

I changed the order of the calls to redirect and invalidate, and changed the reference to /smsinfo/login.jsp. Another interesting thing is I had the location for logout.jsp wrong in the <a> tag on the page, but it seemed to find it, then I changed it, and it still found it. I'm wondering if maybe caching in the browser somehow added to the confusion?
 
Consider Paul's rocket mass heater.
 
subject: Where does the server look for stuff?