Re: Session Problems Apache httpd - tomcat
On Thu, 2007-03-29 at 09:43 +0100, Pid wrote: They don't go through it automatically, as the links are in the page output, and tomcat doesn't hunt through output streams for URLs to encode. All URLs need to be manually encoded, in your JSPs or Servlet outputs. Check with your developers to ensure that this is the case. If the URLs are properly encoded Tomcat will then rewrite the URL to include the session data in the URL if cookies are not available. Your URLs will then look something like: /path/to.jsp;jsessionid=?query=goes+here This and the addCookie worked perfectly. The developers are working on a fix right now. The HTTPD is largely agnostic of the sessions - unless you are clustering - as it won't interfere with a cookie, and will pass a URL parameter through as normal. Q: How have you connected HTTPD/Tomcat, and which versions are you using? Tomcat 2.2.23 Apache httpd 2.2.0 mod_jk 1.2.15 If you *are* clustering then you need to ensure that the jvmRoute attribute of the Engine in conf/server.xml is set uniquely for each Tomcat. (http://tomcat.apache.org/tomcat-5.5-doc/config/engine.html) This adds the value of the attribute to the end of the jsessionid so that your load balancer can direct the session to the appropriate Tomcat. No clusters yet, though we will be looking into it as soon as I learn a bit more. Thanks a lot Christopher, Pid and Nicholas, your help was very valuable. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session Problems Apache httpd - tomcat
On Thu, 2007-03-29 at 12:20 -0400, Christopher Schultz wrote: Honestly, you should never have to do anything with cookies yourself... Tomcat should handle any required cookie manipulations. I think it will just clutter your code and confuse anyone reading it. It's working without any code, but when I add traffic to the application it stops working and for every refresh it makes a new session. The workaround I offered was to force the session and that's the only thing working right now. Any ideas on that? - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session Problems Apache httpd - tomcat
Hello everyone, I'm new to the list and I've been using tomcat for quite some time now and have a little question. Any help would be greatly appreciated. I've made a little jsp to show me the current session I'm on, when using it on a standalone tomcat server the session never changes, when I move it to an apache httpd server with mod_jk connected to the same tomcat server the session still doesn't change, but when I add some traffic to both the httpd server and the tomcat server, the sessions start changing with every click and I'm having some trouble with the applications I'm deploying. I'm using: 1) Apache httpd 2.2.4 2) Apache tomcat 5.5.23 3) mod_jk/1.2.15 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session Problems Apache httpd - tomcat
On Wed, 2007-03-28 at 16:14 -0400, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nelson, Nelson D. guerrero wrote: I've made a little jsp to show me the current session I'm on, when using it on a standalone tomcat server the session never changes, when I move it to an apache httpd server with mod_jk connected to the same tomcat server the session still doesn't change, but when I add some traffic to both the httpd server and the tomcat server, the sessions start changing with every click and I'm having some trouble with the applications I'm deploying. Hmm... How are you checking to see if the session has changed? Are you looking at request.getSession().getSessionId()? Or are you looking at some particular object in your sessions to see if that has changed? - -chris Hello Chris, I'm using request.getSession().getId(). - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session Problems Apache httpd - tomcat
On Wed, 2007-03-28 at 16:32 -0400, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nelson, Nelson D. guerrero wrote: How are you checking to see if the session has changed? Are you looking at request.getSession().getSessionId()? Or are you looking at some particular object in your sessions to see if that has changed? I'm using request.getSession().getId(). Okay. Are you using cookies or URL-rewriting in order to track sessions? Oh, and what is your session timeout? - -chris No, the developers are using cookies or URL-rewriting, is this the only way that the sessions can replicate between them? I'm thinking on passing them this piece of code: ((HttpServletResponse)response).addCookie(new Cookie(JSESSIONID,session.getId())); That will surely help. Tomcat has the default timeout of 30 minutes. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session Problems Apache httpd - tomcat
On Wed, 2007-03-28 at 17:00 -0400, Christopher Schultz wrote: Assuming that Tomcat is managing your sessions (there aren't too many good reasons to manage your own sessions), then Tomcat uses either cookies or URL rewriting to maintain sessions between requests. I'm sorry, I'm not following. By saying managing your sessions, do you mean running tomcat standalone or letting tomcat manager the sessions and that the httpd uses the sessions off of the tomcat? Probably not: Tomcat should do this for you already. Usually, sessions get lost because Tomcat has had to resort to URL rewriting, but the application has not been written with this in mind. For instance, every single URL that you generate ought to go through request.encodeURL to make sure that the session id is properly added if necessary. If you don't do this, then you'll end up creating a new session when you use that (session-less) link. Do they go through request.encodeURL automatically or do I have to do something? Sorry for all the questions, I'm no developer and I'm surely not a tomcat administrator, they just shoved me the responsibility a couple of months ago and I've been learning ever since. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]