Loosing session

I created 2 very simple files and trying to set session attribute in one of them and retrieve it in the next one. There is a link from the first to the second.
I always get new session in the second JSP.
Source of the 1st file :
<%@ page import="java.sql.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="java.io.*" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.jsp.*" %>
<%@ page session="true"%>
<%
session.setAttribute("test_attr","_data_sample");
%>
<html>
<head>
</head>
<body>
<%
String in_session = (String)session.getAttribute("test_attr");
out.println("Session attribute value is : " + in_session + "<br>");
out.println("Session ID : " + session.getId() + "<br>");
out.println("Is Session new : " + session.isNew());
session = request.getSession(true);
out.println("Did we join the session : " + session.isNew());
%>
Click here
</body>
</html>
source of the 2nd JSP :
<%@ page import="java.sql.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="java.io.*" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.jsp.*" %>
<%
session = request.getSession(true);
String new_str = (String)session.getAttribute("test_attr");
out.println("Test session value : " + new_str + "<br>");
out.println("Session ID : " + session.getId() + "<br>");
out.println("Is Session new : " + session.isNew());
%>

Put session.setAttibute after html tag in first page, sometimes work :D

Similar Messages

  • Loosing session variables in tom cat web app

    Hi,
    I have a very strange problem. I keep loosing session state when I open a JSP from another one.
    The funny part is that it only happens when I access my application from outside my LAN. when I test my application from a client located inside my LAN I have no problems. It raeds session variables with no problems. When I teste t from outside my LAN where the server is located it looses my session variables. i acts as if it has timed out.
    Can you help me with this? The Tom Cat version I`m using is 4.1.27 and the JDK is 1.3.1.
    Many thanks,
    Rui Silva

    travis is right. You should make sure you always pass all your URLs through the String response.encodeURL(String) method. Some users may not be able to accept cookies, others may intentionally turn them off. If you want you app to work in all cases, then your URLs need to be encoded.
    This counts for URLs as part of links, form actions, javascript submissions, etc...

  • Loosing session data between servlets...

    Based on the code below I'm loosing the session data i.e the class indexed by the session id is returning NULL. If anyone has any suggestions I would apprciate it.
    Class 1:
    HttpSession session = request.getSession(true);
    Hashtable books = (Hashtable) session.getValue("books");
    if (books == null)
    books = new Hashtable();
    else
         books = null;
         books = new Hashtable();
    session.putValue("books", books);
    Class 2:
    HttpSession session = request.getSession(true);
    Hashtable booksOrdered = (Hashtable) session.getValue("books");
    System.out.println("booksOrdered: "+ booksOrdered):
    The system.out.println statement returns
    booksOrdered: NULL
    Help please
    Lee Paulison Jr

    I forgot to mention that the code was working up until I installed the March 4 - 28 2002 Windows NT Critical updates. The code worked after the update when I changed to a different login name namely Admin. Then after a few hours it stopped working, and continues not to work on any Login. I hope that this last bit of information helps someone come up with a fix.
    Lee Paulison

  • Opening new window on button click from pdf without loosing session

    Hi,
    In my Java web applicaion on click of a link, we are opening a new window in which we are displaying a pdf. There are 5 buttons on this pdf.
    On clicking of this button again we are opening a application link in new window. But in this window we are not gettting our session, which is there in first two window.
    For opening new window from pdf button click we are using
    var dynamicUrl3 = myappurl;
    app.launchURL(dynamicUrl, true); 
    How can i open new window with the same sesion from the pdf button.
    Please help for the same.
    Thanks,
    Abhijit Mohite.

    Yes, with target="_blank" in a link or a form.Thanks for ur valuable suggestion. I changed the button to link.
    Its working fine now without JavaScript.
    Now i got another requirement. When user select some items and press a button in the new popup window, the window must close on button click and the parent window must refresh. This must also be done without using JavaScript.
    Is this possible? Please give me an idea to do this.
    Thanks.

  • HELP ..cluster is loosing session when a clusterserver is down

    Hi,
              our cluster consists of an admin Server and two managed Servers on different
              machines.
              They are connected via active/Standby secure Switches.
              So the application should give the used session to the other managed Server
              when the first has an emergency shutdown.
              But sometimes it does and sometimes NOT.
              So could there be any configuring in BEA to avoid this problem ?
              Thanx in advance
              André
              

    The two machines need to be always connected - are they? ( I don't know what
              an active/Standby secure switch is).
              If the first application has an 'emergency shutdown' it is dead - it is too
              late for it to give the used session to the other server.
              Clustering keeps a second, up-to-date session on the other server at all
              times.
              Mike
              "A. Zeglin" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              > our cluster consists of an admin Server and two managed Servers on
              different
              > machines.
              > They are connected via active/Standby secure Switches.
              > So the application should give the used session to the other managed
              Server
              > when the first has an emergency shutdown.
              > But sometimes it does and sometimes NOT.
              > So could there be any configuring in BEA to avoid this problem ?
              >
              > Thanx in advance
              >
              > André
              >
              >
              >
              >
              

  • Loosing session attributes

    I am working with WLS 5.1, personalization server and SP3 on WinNT.
    The portal we are designing consists of a number of distinct WLPS
    portals, each providing a piece of the entire functionality of the site
    (main portal, classified ads, forums, news, classes, calendar, etc.).
    The logon/logoff processes automatically log the users onto and off of
    all the portals automatically. There is a menu that appears in all the
    portals for navigating.
    Everything works fine except for one small detail. When a user goes
    into the calendar portal, for example, he or she is able to change the
    view and the date (like Yahoo). If this user leaves to go to another
    portal, then returns, the variables stored in the calendar portal may or
    (most likely) may not be there.
    Is there something in the configuration of the portals that causes this
    to happen?
    Thanks
    Monte

    Finally found out what was happening. Turned out to be a problem with Netscape
    Navigator.
    Under WLS 451, if you stopped and restarted a server, Netscape usually gave you
    a garbage message the next time you accessed WL because of the previous session
    information stored in the browser. The solution was to close/restart Netscape.
    Under WLS 51, however, the message has disappeared, leading myself (and I'm sure
    others) to assume that closing and restarting Netscape is not longer necessary.
    Well, after witnessing increased loss of session data from my new portals, I
    tried starting up the demo portal and it didn't work either. That's when I
    finally figured out that the browser was the culprit.
    Unless there is a way of protecting the end users from stops/restarts, you
    should be careful about doing so in production.
    Saludos
    Monte
    Monte Kluemper wrote:
    Monte Kluemper wrote:
    I am working with WLS 5.1, personalization server and SP3 on WinNT.
    The portal we are designing consists of a number of distinct WLPS
    portals, each providing a piece of the entire functionality of the site
    (main portal, classified ads, forums, news, classes, calendar, etc.).
    The logon/logoff processes automatically log the users onto and off of
    all the portals automatically. There is a menu that appears in all the
    portals for navigating.
    Everything works fine except for one small detail. When a user goes
    into the calendar portal, for example, he or she is able to change the
    view and the date (like Yahoo). If this user leaves to go to another
    portal, then returns, the variables stored in the calendar portal may or
    (most likely) may not be there.
    Is there something in the configuration of the portals that causes this
    to happen?
    Thanks
    MonteWhen the user is not logged in, everything works correctly. The problem
    occurs only once the user identifies himself. The code for the login jsp is
    enclosed.
    Name: _userlogin.jsp
    userlogin.jsp    Type: application/x-unknown-content-type-jspauto_file
    Encoding: base64

  • Loose session between requests

    We are using WLS 6.0 with the Apache web server. Our initial page comes up
              and we store some information in the session. We enter user name password
              press sign in and the servlet looks in the session and it is empty. I have
              dumped the session and it is completly empty plus the session Id is not
              different so some in the chain thinks this is a new user and has created a
              new session object. This does not happen when we go in to the WLS http port,
              only on port 80 for Apache.
              Thanks in advance for the help
              Gary James
              Homestore.com
              [email protected]
              (W) 480.609.4645
              

    Hi Satish,
       We are working on the same sort of scenarios, where we have to call more than one webservice in a sequential fashion using the same session id details.
        What we did was we built new xsds adding session details node using the webserive request and response xsds. And we are maintaining a sessions table which contains session id and  status fields in PI. So we send webservice request with the session id details. We wrote an UDF to get the session details from PI and set the status field as busy so that no other request uses the same session details.
       Webserive response again contains the sessions details which can be used for the next webservice request.
      Finally after all the calls set back the status to Active in PI table.
    Webservice Calls From a User Defined Function
    /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
    Hope this helps.
    Thanks,
    Vijaya.

  • Session expiration issue with parent and child window

    Hi,
    We have two applications (App1 - Implemented using JSF, Spring and Hibernate and App2 -Implemented using Spring MVC, Spring JDBC).
    I have implemented 'Test Access Content' functionality in App1.
    First admin user (Role- Manager) needs to login to App1
    As part of 'Test Access Content' functionality, he enters URL with encrypted key and click 'Test Access' button.
    It opens new window (implemented using java script - window.open) and hits spring controller of App2.
    In spring controller of App2, I am decrypting the key to get user details. After that i am setting user details in session, constructing final URL to display actual content.
    Problem is parent window maintains session till child window renders response. Once child window renders response, parent window loosing session.
    So, if i click any button in parent window after child window renders response, it displays login page as there is no session for parent window.
    Please note that App1 and App2 are sharing same domain. only context paths are different for both apps (app1 and app2).
    Any suggestions on this issue are much appreciated. Please let us know if you have any questions.

    Hi,
    When you open a child window from parent window then you can access child data in the parent window through javascript.
    We have a main web page. There are quite many links on it from which >user can open new web pages but the data is saved when the submit >button on the main page is clicked. Also data that user entered on the >other sub pages is not displayed in the main window.
    1 is this a case of parent and child window.case 1 When you are submitting the main page you need to run javascript function and get data from child windows and save that to database or session. next time when you are displaying the main window you need to query session or database to display the child window data in the main window.
    Case 2> closing child window and you need data in the parent. This can be done in two ways.
    1> When you are closing the child window populate some variables of the main window using javasript.
    2> Save the values in the database or session and refresh the main window and extract data from database or session
    Where should the data be saved that user enetered on the sub pages as the data is not shown in the main page - should it be stored in the session?It is design decision. You can store data in either session or database when you are closing the child window. But ifyou are saving the data on the main page then you can populate main page with child windows data using javascript. Save the data t database when main window data is saved. Depends on business requirements.
    In short if you are saving child windows data in session or database then you need to refresh main screen to pull that data otherwise populate main screen using javascript.
    I hope i answered your questions :) best of luck

  • Hardware load balancing with session stickiness

    Hello,
              We are looking for a hardware based solution to load balance 4
              unclustered weblogic servers. These servers are software replicas of
              each other and share a common database. We need a solution that
              provides session level server stickiness based on jsessionid as both a
              cookie and url rewrite. Currently we have Cisco load balancers which
              do not handle the url rewrite due to the fact the the load balancer
              only "sees" what is after the question mark in the url and the
              jsessionid is before the question mark. Example:
              http://somehost.com/some/url.jsp;jsessionid=26D5C566075663ABD8E17AD255974323?parm=value
              I'm sure we are not the only ones trying to do this. Any suggestions
              would be greatly appreciated.
              Thanks,
              Alan George
              

              Having worked on Cisco load balancer and WLS clustered, you would loose sessions
              when the requests are failed over.
              S
              "Shawn Kircher" <[email protected]> wrote:
              >
              >Has anyone got this type of scenario working where you load balance sticky
              >sessions
              >from a Cisco load balancer between non-clustered weblogic servers?
              >
              >Thanks,
              >
              >Shawn
              >
              >"Aravind Krishnasamy" <[email protected]> wrote:
              >>F5 or BigIp provides hardware level load balancing and it injects date
              >>inside weblogic cookie and maintains server affinity.
              >>Thanks
              >>Aravind
              >>"ageorge" <[email protected]> wrote in message
              >>news:[email protected]...
              >>> Hello,
              >>>
              >>> We are looking for a hardware based solution to load balance 4
              >>> unclustered weblogic servers. These servers are software replicas
              >>of
              >>> each other and share a common database. We need a solution that
              >>> provides session level server stickiness based on jsessionid as both
              >>a
              >>> cookie and url rewrite. Currently we have Cisco load balancers which
              >>> do not handle the url rewrite due to the fact the the load balancer
              >>> only "sees" what is after the question mark in the url and the
              >>> jsessionid is before the question mark. Example:
              >>>
              >>>
              >>http://somehost.com/some/url.jsp;jsessionid=26D5C566075663ABD8E17AD255974323
              >>?parm=value
              >>>
              >>> I'm sure we are not the only ones trying to do this. Any suggestions
              >>> would be greatly appreciated.
              >>>
              >>> Thanks,
              >>>
              >>> Alan George
              >>
              >>
              >
              

  • Can we preserve the session while navigating to PDF using sessionId

    Hi,
    I have a requirement like i am navigating to PDF page where we have few buttons on click of those links we trigger some application functionality in a different window.
    I want to restore the session in the new window, any suggestion are welcome!
    The thing i observed is while opening PDF we are loosing session because PDF file is not associated with browser and when clicking on PDf button it is opening entirely new browser window instead of child window of the parent window.
    Can we restore the session using sessionId actually i can send the sessionId by appending it in URL using URL rewriting.
    Thanks,
    Mahendra
    Edited by: mahendra13 on Feb 17, 2010 4:27 AM

    In the connection tag of the server.xml give the server name as you want. which will be prefixed in the JSESSION ID
    <CONNECTIONGROUP id="s" matchingip="default" servername="www.xyz.xom" defaultvs="test">

  • Session gets lost when proxied through a server

    Hi,
    Did anyone come accross loosing session valued when proxied by a server.
    Does anyone have some work around for that?
    Please let me know.
    Thanks,
    Kavitha

    If you use a JSP to generate your form, the following is possible.
              <FORM METHOD="POST" ACTION="<%= response.encodeURL("someurl")%>">
              -brian
              Mike Williams wrote:
              > >>> On Mon, 27 Mar 2000 10:08:30 -0600,
              > >>> "Jim" == "Jim Clark" <[email protected]> wrote:
              >
              > Jim> Try using URL rewriting when the browser doesn't support cookies:
              > Jim> weblogic.httpd.session.URLRewriting.enable=true
              >
              > From the documentation, it seems that you still need to use encodeUrl().
              >
              > Curiously, the value of "weblogic.httpd.session.URLRewriting.enable"
              > doesn't seem to have any effect! However I set it, encodeUrl() still adds
              > a "WebLogicSession" parameter to the URL.
              >
              > Again, this helps with links, but I still lose my session when I use HTML
              > forms, as there seems to be no way to encode the session-ID in the request.
              >
              > Any ideas?
              >
              > --
              > cheers,
              > Mike Williams
              

  • Users losing session on 11500 series Content switches

    What would cause users to loose session connection on the 11500 series switches.Arrowpoint cookies are been used.

    the CSS has an aggressive way of destroying idle connection.
    If a connection stays idle for 8 sec, the CSS mark it has idle.
    Once marked idle, a connection will stay idle forever for the CSS - even if traffic is still going on between client and server.
    So at some point of time, the CSS will decide to reuse the memory used to switch a connection marked idle.
    At this time, the user will lose his session.
    The solution is to increase the idle timeout.
    The command is 'flow-timeout-multiplier' and you configure it per content rule.
    Give it a try with a timeout multiplier of 20 and see if this improves the situation.
    You may have to increase the value.
    Gilles.

  • MSCS node move and lost sessions

    hi there,
    I'd like to know if sessions lost during an MSCS node move is a normal behaviour with Microsoft Windows 2000 AS, SAP R/3 4.7 (CI instance) or there's something wrong with our configuration.
    thank you.

    Hi,
    We just completed the SAP installation on Cluster. Loosing sessions when you move the group is normal behavior. SAP resource will be restarted on the surviving node. Hence the user will loose the connection.
    Check http://www.microsoft.com/NTServer/Support/faqs/clustering_faq.asp for more details:
    For client-side applications that have "state-full" connections to the server, a new logon is typically required following a server failure. In many cases, this approach is required for security purposes. For example, this is how SAP R/3 works--if the server connection is lost, the user is prompted to log on again to make sure it's the same user accessing the application.
    Regards
    Subbu

  • Firefox is already running but not responding/random page-load stalls.

    Lately when I use Firefox, everything works initially when I first open a browser and start my browsing session, however, when I come back to my already opened browser from my desktop either being asleep or in screensaver mode, the browser will often no longer load webpages. I then go to close the browser to reopen it, I receive the error message:
    "Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system."
    I've researched this error, and some discussions mention it deals with the default profile for the browser. I deleted the default profile, and created a new profile, and still receive the same issue. Also I have downloaded, uninstalled, and have done a clean reinstall of Firefox 4.01 and still receive the issue.
    Do you know what could be the problem? Thanks for your help.

    Access Rights
    It would be better if someone with Vista knowledge answered you.
    I use XP pro & XP home edition so do not know answers for Vista. XP pro gives detailed security info and settings, XP HE it is a lot move difficult to figure out, and displays a greyed out tick/check-mark as the folders ''Read Only'' attribute. If you look within the folder you will see files such as ''places.sqlite'' as long as such files have very recent dates/times you can assume firefox does have write permissions on the files.
    As a test I suppose you could create a new profile and using profile manager create the profile folder on the Windows desktop, where you can be sure you will have access rights to it.
    I suggested changing the sleep settings etc, because if you suspect it is the sleep etc function causing the problem that may show up quickly if you change the OS settings to a short delay before it sleeps.
    Presumably when you see the error messages you are seeing the firefox.exe process is still running when you look in Task Manger. Try deliberately bookmarking open tabs to a folder and closing all but a blank page tab before closing down firefox that may help remedy the problem.
    You could also check to see if you have multiple copies of sessionstore.js (you will loose session restore info if you delete them, but at least move them out of the profile, they could be a cause of the problem) see http://kb.mozillazine.org/Firefox_hangs#Multiple_sessionstore.js_files

  • WLC 7.4.100.60 and roaming problems on 8500

    Hello,
    After installing an 8500 controller on 7.4.100.60 and migrating 1000 APs do this controller, we have the following problems:
    [1] clients get disconnected and loose sessions (note: client is mobile gun and is heavily mobile). I have the impression there are more coverage holes. This might be due to bug CSCue13108, but says fixed in 7.4.100.60, we wil be upgrading to 7.4.110.0 anyway shortly.
    [2] we have lots of L3 roaming problems between clients, especially when clients roam between old WISM controller and new 8500 controller. They don't roam, they get disconnected and reconnected, resulting in ip address change, resulting in sessions loss. Old controller still runs 7.0.230.0 but compatibility matrix says these two versions are L3 roaming compatible.
    However, the release notes of 8500 mention this: "Cisco 8500 Series Controller cannot be configured  as a guest anchor controller. However, it can be configured as a foreign  controller to tunnel guest traffic to a guest anchor controller in a  DMZ"
    Because Layer 3 roaming is similar to guest traffic tunneling, does this mean that the 8500 can be the initiator of a L3 roam tunnel, but cannot be the endpoint of a L3 roam tunnel ?
    We have done a test that seems to confirm this: client starts on 8500 in state "local", goes to AP on old controller (7.0.230.0), but roam doesn't work. Client gets re-associated with ip address change. Then when moving back to the 8500 controller, the client does roam successfully, keeps its ip address in the 7.0.230.0 vlan and gets status "foreign" on 8500 controller. controllers are in same mobility group and mobility connections are all up.
    In the 7.5 release notes, this limitation is not mentioned anymore. Does it mean it is solved and 8500 can be used as guest anchor controller in 7.5 ??
    regards,
    Geert

    [2] we have lots of L3 roaming problems between clients, especially when clients roam between old WISM controller and new 8500 controller. They don't roam, they get disconnected and reconnected, resulting in ip address change, resulting in sessions loss. Old controller still runs 7.0.230.0 but compatibility matrix says these two versions are L3 roaming compatible.
    Roaming from one AP to another that shares the same controller is totally different with inter-controller roaming, which you have now.  I believe WiSM-1 has 180 ms compared to the 90 ms on a 5508.  And this time difference means alot.
    So when your client goes from one controller to another, they actually have to do a full re-authentication to the new controller.
    I presume both the old and new controller are in the same Mobility Group?
    However, the release notes of 8500 mention this: "Cisco 8500 Series Controller cannot be configured  as a guest anchor controller. However, it can be configured as a foreign  controller to tunnel guest traffic to a guest anchor controller in a  DMZ"
    Pffft!  That'll be the most expensive Guest Anchor Controller if I follow this solution.

Maybe you are looking for

  • Error while updating ADF task

    Hi, I'm using an initiator Task with ADF Form in BPM process with SOA version 11.1.1.6 and JDeveloper 11.1.1.6 and everytime I try to update the task I get this error: ORABPEL-10101 Error while updating task . Error while updating task Cannot delete

  • Stock determination during goods issue

    Hi expert, our client has one requirement in such a way whem they issue the material , at that time they could see batch wise stock and acordingly they could issue the material. i have assigned stock determination rule and group to material master as

  • CRM - Pricing User Exit in Java - BADI CRM_COND_COM_BADI

    Hi All I have to convert some user-exit from Abap to Java in order to work in CRM Pricing Scenario (I use VMC technology based on Web AS 7.00). In the manual attached to note 809820 (New userexit concept for pricing) I find this chapter but I don't u

  • How can i change backgroud color in Java ME Platform SDK 3?

    Hello. Yesterday i had donwloaded Java ME Platform SDK 3.0. It is IDE based on NetBeans core, but i didn't find any facility to change default colors. (NetBeans have option to change color theme). I am don't like working when background color is whit

  • NCHAR issue with oracle database using JDBC adapter

    Hi, We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into ora