aspose file tools*
The moose likes Tomcat and the fly likes Maintaining JSession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Maintaining JSession" Watch "Maintaining JSession" New topic
Author

Maintaining JSession

Sean McGarvey
Greenhorn

Joined: Jun 15, 2005
Posts: 9
I have a web application that uses Java Applets and Servlets. The applets are actually embedded within a servlet generated jsp. I have been hosting this application with JRun using Apache and IIS, but am trying to move it to JBoss.

The problem that I am having is with reproducing an Apache/Tomcat/Jboss environment that I have found (actually for another application) which works perfectly for my application.

In the environment that I have setup, when I log on to my application (from a jsp logon page), my applet builder servlet seems to imediately loose the session. What I am observing is that the url displayed has the jsessionid added to it (which doesn't happen in my working environment) like this:

http://samcgarvey/myapp/html/index.jsp;jsessionid=6663CB32CC64EF58EB7BE71DAAE366EB.samcgarvey

Also, the internet explorer privacy report shows that IE blocked a cookie, even though I am positive that IE is setup to allow all cookies.

One difference between the two server environments (that I am awair of) is that the working environment uses JavaService to run JBoss and the other is just running JBoss using the run.bat command. I am having some difficulty setting up the JavaService and am more concerned with the jsession problem at this point. Could this be my problem?

I am running out of ideas here. Any suggestions would be greatly appreciated.

Thank you in advance,
Sean
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Check your MSIE settings to see if session cookies are being blocked.

Tools -> Internet Options -> Privacy (tab) -> Advanced (button).

There is a checkbox for session cookies there.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sean McGarvey
Greenhorn

Joined: Jun 15, 2005
Posts: 9
I tried checking the Allow All Session Cookies check box and I also tried setting it to Allow All Cookies (the lowest security level) and IE still tells me that it is blocking a cookie. When I access this same application from the same IE (on the same pc) through a difference server, the cookie isn't blocked, the jsessionid doesn't show up in the url and everything works properly. When I say that I am running the same application, I mean that the app.war files are identical.

If I log onto the application on the server that isn't working properly using localhost in the url, the application functions properly. Why would it work when I use access it locally using localhost and not when I access it through our LAN using the server name?
Sean McGarvey
Greenhorn

Joined: Jun 15, 2005
Posts: 9
Also, I just noticed that when I try to access it locally (from the server) using the server name instead of localhost, IE reports that the cookie is blocked and the jsessionid shows up in the url. The servlet session is lost.

Any ideas would be greatly appreciated.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The server puts the jsessionid in the url when it can't read a cookie back from the browser. Is there a firewall in the mix somewhere that's blocking cookies?

Have you tried with another browser, like FireFox?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Another test you could try is to put a real simple app on your server and see if IT can set and read a session cookie.

This one is pretty simple.


If cookies are working you'll see the same sessionID every time you refresh the page. If not, you won't.

If that app works, you know the environment is good and there is an issue in your other application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maintaining JSession