session problem


EJB design: session problem

  1. session problem (3 messages)

    Server:tomcat5.0 My application is using session cookies extensively and so far I had no problem. In a new feature I’ve added, a variable is saved on the session itself using: session.setAttribute("v.code", code); Obviously in a different action we are using: String code = session.setAttribute("v.code"); The whole thing worked nicely until I moved it to the production server where setAttribute("verification.code"), returned null. I printed session.getId() and found out that it's different each time the page refreshes. I assumed that this has to be a load balancer sticky session problem; I then tried to connect directly to tomcat by typing it's ip in the url and witnessed the exact same problem, even though no load balancer is involved. 1. I am using the same version of tomcat in the office and production. 2. This is not a load balancer related problem. 3. This is not a directory permissions problem. Any ideas? Anyone? Thanks in advance, Liorb.

    Threaded Messages (3)

  2. Re: session problem[ Go to top ]

    Hmm... Not really enough information to truly have an answer, but.. I assume your browser is not the issue, because it works in your development environment in your browser. Opps just thought of it, clean your cookies, and caches, restart your browser, might as well do the whole computer, I am unsure how some browsers cache information in memory. #1: If I may suggest, checking the isNew method on session just to ensure that it is new. 99% sure what it will tell you but here is the info: A servlet should be able to handle cases in which the client does not choose to join a session, such as when cookies are intentionally turned off. Until the client joins the session, isNew returns true. If the client chooses not to join the session, getSession will return a different session on each request, and isNew will always return true. #2: Lets still assume that the information is being lost between your server and your browser. Sometimes different network paths may lead down other network infrastructure. Most of which should be HTTP 1.1 enabled, but there are a few rogues out there. Some development tools have an HTTP Monitor built into them, like Netbeans. if not a great free opensource lots of information, but easy to get lost. A better suggestion is to grab one of your network guys, if you have one, and have them trace the information to see where the jsessionid from Tomcat is being dropped. If it works in development (Same server/same configuration) most likely it is environment/network issue. best of luck. Tony Sun Certified Web Business Component Developer Sun Certified Web Components Developer Sun Certified Programmer for the Java 2 Platform
  3. Re: session problem[ Go to top ]

    String code = session.setAttribute("v.code");
    If the above code doesnot have setAttribute due to a typo in the message, can try using session.getAttribute("v.code"); Regards, Rakesh.
  4. Re: session problem[ Go to top ]

    It's mostly likely a cookie issue. Either the browser is not accepting the cookie from the server, or the server is building the "wrong" cookie, i.e. not one that reflects the URL that the page is being served from. Peace, Cameron Purdy Oracle Coherence: The Java Data Grid