Tomcat loses reference to ActionForm in session

Hi,
I have an application running on Tomcat 5.5.4 that uses a Struts 1.1 ActionForm in the session. This form is initialized with data and then sent to the jsp form. If the user is some time in submitting the form, the Form bean will occationally be dropped from the session. This creates problems in that Struts will create a new ActionForm to handle the request and the data is not initialized.
When this occurs, other attributes in the session are still present. It also happens only rarely and seemingly at random. I can see no reason for the Form bean to be lost, and since it is happening between requests, I do not see how it could be my application code.
Does anybody have any clue what might be going on here?
Thanks

Sorry - you said that in your initial post. Guess I should have read it more closely.
I agree with you basically. If the object is in session, and you make no requests on the server, the object should still be in session when you get back to it. (provided session is not invalid, which you say it isnt')
As I understand it there are two circumstances when a new ActionForm would be created
1 - it is not in the session
2 - the object under that name in the session is not compatible with the actionFormType for that mapping.
Can you confirm if the object is still in session? (maybe through another page in the same session, displaying all session attributes) Is it the same one?
Is it possible that the form is getting used in other requests in other pages? ie the user has multiple browser windows open? That might explain it (I'm clutching at straws here)
Apart from that I can see no logical cause for the behaviour you have described
Cheers,
evnafets

Similar Messages

  • Tomcat single sign-on and reloading session parameters

    Hello,
    I am planning to write three web applications that will run under tomcat 5.5. I am planning to implement single signon capability by using Realms and Form-based login.
    Right after a user log's in, I want to query the database and load some frequently used information into Session as parameters, so that I don't have to query the database over and over again to get the same information.
    All three webapplication are going to put the same information in Session for each user, so I was wondering if there is a way to share this information across the three web applications? Do I need to query the database everytime the user moves from one application to another or is there a better/easier way?

    yeah, create a class to put it all in then put it in the session.
    session.setAttribute("myobject", object);
    use the web.xml to point the applications to a welcome page, that will check if this value in the session is null, and if it is gets the information, and if it isn't doens't do anything with it.

  • Error at tomcat starting :IOException  while loading persisted session. : j

    I am gettin error when tomact starts.error is like this "IOException while loading persisted session. : java.io.writeabortedexception.;writing aborted;java.io.Notserializable exception.
    what is this error .I think it is due to session scope of bean.what care shold be taken if you are using session scope.please help me;
    thanks

    To where are you persisting your sessions? If you don't care about session persistance, try making this change in your server.xml.
    <Context path="/myApp" reloadable="true" docBase="myApp" workDir="C:\myApp\\work\org\apache\jsp" >
    <Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
    </Context>I got this from http://forum.java.sun.com/thread.jspa?threadID=575302&messageID=2871444
    Check it! Bo!

  • StorageItemThumbnail seems to lose reference/thumbnail over time?

    Hi there,
    I encountered a strange behaviour multiple times in the past now. I'm creating a GalleryApp which retrienves FileInformation with GetVirtualizedFilesVector() and appropiate Settings. Then the bound Thumbnails are converted with a StoreagetemThumbnail Converter
    to the Image source.
    Everthing is working fine so far. Also the Thumbnails are displaying fine if the files where just added. A Folder hast to be picked first from the user.
    But after some (random?) time most of the Thumbnails won't Display anymore. The files are in the same Location, the Folders accessrights are still there. Oddly enough some files do Display there thumbs but within in the same Folder they're gone. They are
    just blank.
    To prove that there's maybe some filesystem Caching mystery going on:
    If I reselect the Folder through the Windows-Folderpicker and the Images/Thumbnails are displaying within that Folderpicker and I go back to my Gridview with the Thumbnailimages they're suddenly displayed again. Even if I Close the App in the Moment the Folderpicker
    is getting the Contents.
    So there must be some Caching going on which is loosing it's Contents?
    I also could reproduce that behaviour with other Apps from the store.
    Additionally I have the "feelling" that Thumbnails from SSDs are lost earlier thant that from slow HDDs?
    Has somebody else experienced that behaviour?

    -- edit ---
    Ah sorry, I'm the same Person btw. Private and corporate account that is ;)
    Hi there Anne,
    ok I put together a mini-Repro. I stripped down my whole Project to the very bits, leaving the part needed to reprodurce this behaviour. I would love to send you a download link as pm, but can't figure out how ;) I would not like to post it here, because
    it is part of a commercial product.
    Apps to reproduce
    GalleryHD and "Photo Fast Viewer" - but they seem to do something different, as I have a lot of missing thumbs in their apps also at initial state, not just over time.
    Also you can check the great Project from Mike Taulty over here: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2013/01/25/windows-8-making-a-simple-photo-viewer-in-c-and-xaml.aspx - download link for short: http://mtaulty.com/downloads/W8Pictures.zip
    What is to reproduce?
    Well, in both apps above as mentioned, there a lot of missing thumbs. Not just over time, also at initial state. But the latter would be another Problem. But Mike Taulty's app also had missing thumbs for me.
    Usual suspects
    As I tried to reproduce that behaviour I installed my app also on several machines. 5 PCs so far, two Surface tablets following. I noticed that on some of those machines I had "sage thumbs" installed. A tool that can Show thumbnails of different filetypes
    in the Windows Explorer. Also "Sony Raw Driver" is installed on one of those machines.
    I deinstalled sage thumbs on one machine to narrow down the possibility of the circumstance that that tool could affect the thumbnail Caching - or retrieving - or whatever. But I hardly believe that's the case. Just to be sure anyway. It will tell over time.
    Network Share Example:
    The whole thumbnail retrieving from many Folders is somewhat erratic.
    To have the same common base of testground I Setup Picture Folders on a Network share on a synology nas which is connected as Network drives on all my testing machines (make that seven including the tablets). I installed my app and also my testcase Scenario
    on all of them.
    Interesting enough alone is the fact that on some machines the thumbs from the very same network-Folder with a lot of pics are displayed fine, while on the next some are missing right after the initial "Import".
    I really do hope that I made some serious mistake and it's all on me. Even to make myself Feeling embarresed if that would be the case ;)
    The last way out for me would be either to convert the original source to scaled down Bitmaps or to do Manual thumbnailcaching in the localstate Folder - which I would tend to avoid.

  • How to cast back and use a retrieved Session Bean reference in a servlet?

    Please help!
    1. I invoke a Session Bean from a servlet :
    travelagent = home.create();
    2. I store the travelagent reference in the HTTP Session :
    session.setAttribute( "travelagent" , travelagent );------------------------------------------------------------------------------------------------------------------
    Now, in another servlet, I have to retrieve the reference to the EJB from the HTTPSession.
    I then have to use this reference to call a business method in the EJB Session Bean.
    I have tried two ways to retrieve the reference and cast it before calling the business method. I get errors in both forms of casting.
    The Values you will see below in the code:
    EJB Remote Interface : TravelAgent (TravelAgent.java)
    Business Method : listItineraries( )
    Servlet which calls the above method : ListItinerary.java
    Line 46 of ListItinerary.java : ArrayList itineraries = traveler.listItineraries();------------------------------------------------------------------------------------------------------------------
    The two ways along with the error I get on the servlet page in the browser are :
    (A)
    TravelAgent traveler = (TravelAgent)session.getAttribute("travelagent");The error I get is :
    java.rmi.NoSuchObjectException: CORBA OBJECT_NOT_EXIST 9998 Maybe; nested exception is:
         org.omg.CORBA.OBJECT_NOT_EXIST: vmcid: 0x2000 minor code: 1806 completed: Maybe
    com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:208)
         com.sun.corba.ee.impl.javax.rmi.CORBA.Util.wrapException(Util.java:591)
         javax.rmi.CORBA.Util.wrapException(Util.java:277)
         source.traveler.ejb._TravelAgent_Stub.listItineraries(Unknown Source)
         source.traveler.servlet.ListItinerary.processRequest(ListItinerary.java:46)
    (B)
    TravelAgent traveler  =
    (TravelAgent)PortableRemoteObject.narrow(session.getAttribute("travelagent"), TravelAgent.class);The error I get is :
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.RemoteException
         com.sun.corba.ee.impl.javax.rmi.CORBA.Util.wrapException(Util.java:597)
         javax.rmi.CORBA.Util.wrapException(Util.java:277)
         source.traveler.ejb._TravelAgent_Stub.listItineraries(Unknown Source)
         source.traveler.servlet.ListItinerary.processRequest(ListItinerary.java:46)
    Could someone advice on how to retrieve and cast the EJBObject's reference from the servlet so that I may use it to call the business method?
    Thanks!

    Thanks guys! It worked.
    1.. I should have used the handle. Got to coding without going deep in the concepts.
    2.. I dont know if I could have used the EJB Reference directly (instead of the handle).
    3.. The error was due to me not mapping the servlets with the EJBs that they could use. I continued to get the same error even after using the handle. Once I put the mapping to the EJBs correctly, everything fell in place.
    Thanks a lot!
    Henry

  • Session problems in tomcat 5.0.28

    Even I shutdown the tomcat 5.0.28 server the session variable is still existing and it is showing the old values. What I have to do to disable the old values? Is it the problem with tomcat 5.0.28 or with JSP coding!

    Tomcat serializes sessions to the hard drive when it shutsdown. If you don't want this you have three choices:
    1: you can disable this functionality in the server.xml. Check the documentation.
    2: you could just delete the session.ser file when you shut down tomcat. This file is under work/standalone/{webapp name}
    3: you could close and re-open the browser so that the old jsessionid will not be sent and a new session will be created. The old session will eventually time out.
    The third option is probably the easiest.

  • My new version of Firefox crashes as soon as it opens, even in safe mode, at the 'restore session' page. How can I get that session back?

    I updated to the newest version of Firefox and restarted the internet. When it reopened the browser, it had the 'about session restore' tab open, but when I clicked on it, it crashed. I've restarted the computer three times to no avail.
    The browser opens, then says 'Not Responding' before you can click on anything, then crashes.
    The Mozilla Crash Reporter appears, and I click to restart (or quit - same results) then it suggests to open in safe mode, which I do, but the same thing happens repeatedly and I get nowhere.
    It wasn't even generating a crash report but finally one went through to my email: bp-0a80049a-6643-452d-b3b2-d8c622130823.
    I want to restore my previous version, as I had tabs open that I need to go back to.
    Could you please advise me how to proceed?
    Thank you.

    I don't have a good sense of what is going wrong.
    Was Firefox stable in step 3 -- open with no sessionstore.js file and then exit?
    If that was stable, it might be easiest to cull the open URLs from your sessionstore.js file and re-open the most important ones manually. You will lose the ''detail'' of your session on those pages (e.g., data you had entered into a form), but if that's okay, it might be the next step.
    I found a script on mozillaZine that will extract URLs from the sessionstore.js file; I just changed the formatting of the output. To run the script:
    (1) Return to your profile folder and rename sessionstore.js to sessionstore.old again, then copy it to a convenient location
    (2) Start Firefox (it should be in a new session)
    (3) Open the following link, select all (Ctrl+a), copy (Ctrl+c) to copy the script to the clipboard: http://dev.jeffersonscher.com/sessionstore_reader.txt
    (4) Open the <s>Error Console</s> <u>Browser Console</u> (Ctrl+Shift+j), click next to <s>Code</s> <u>the caret (>>)</u> and paste, then press Enter <s>or click Evaluate</s>
    (5) A file selection window should appear. Navigate to the convenient location and open sessionstore.old from there.
    (6) As long as the file is not corrupted, a new tab should open with a list of all the URLs the script found in the file. You can save this page for future reference if desired. Also, you can close the <s>Error</s> <u>Browser</u> Console now.

  • Windows XP crashed and Firefox 5.0 closed improperly. When I relaunched it, I mistakenly clicked New Session button instead of Restore previous session. How can I get that session back now? Thanks

    I am on Windows XP/Firefox 5.0 Computer crashed overnight closing Firefox improperly. When I relaunched I got choice to restore previous session. By mistake I clicked on Start New Session. Now I cant restore that session through Menu, relevant buttons are greyed out. I cant see any pertinent information online either. I appreciate any help. Currently I am digging through the history but for some of these tabs I dont know when I opened them (may be a while ago).

    I don't have a good sense of what is going wrong.
    Was Firefox stable in step 3 -- open with no sessionstore.js file and then exit?
    If that was stable, it might be easiest to cull the open URLs from your sessionstore.js file and re-open the most important ones manually. You will lose the ''detail'' of your session on those pages (e.g., data you had entered into a form), but if that's okay, it might be the next step.
    I found a script on mozillaZine that will extract URLs from the sessionstore.js file; I just changed the formatting of the output. To run the script:
    (1) Return to your profile folder and rename sessionstore.js to sessionstore.old again, then copy it to a convenient location
    (2) Start Firefox (it should be in a new session)
    (3) Open the following link, select all (Ctrl+a), copy (Ctrl+c) to copy the script to the clipboard: http://dev.jeffersonscher.com/sessionstore_reader.txt
    (4) Open the <s>Error Console</s> <u>Browser Console</u> (Ctrl+Shift+j), click next to <s>Code</s> <u>the caret (>>)</u> and paste, then press Enter <s>or click Evaluate</s>
    (5) A file selection window should appear. Navigate to the convenient location and open sessionstore.old from there.
    (6) As long as the file is not corrupted, a new tab should open with a list of all the URLs the script found in the file. You can save this page for future reference if desired. Also, you can close the <s>Error</s> <u>Browser</u> Console now.

  • Session Timeout in weblogic 6.1 SP3-- Urgent

    Hi
    We are currently using weblogic 6.1 SP3 and iPlanet for our application. The session timeout in web.xml is set to 100 mins but the session doesn't timeout, i.e., we can still access the application without being locked out. How can I fix this??
    What is happening is that a new session is being created automatically after the sesion timeout. our application doesn't validate the user.. the authentication is done by some PKI tokens. can that be the reason for this behavior??? If so, how can we fix it??

    What is the heap size ? How many useres are hitting the system ? What is the approx size of the session? Turn on -verbose:gc and monitor the GC activity. Are the sessions really inactive ?
    Make the timeout 30 secs and the InvalidationIntervalSecs to 20 secs and see if it makes a difference.
    If you still have the same results attach the pofiler trace here. A test case would be good too.
    Rakesh Aggarwal wrote:
    We are running a J2EE servlet in Weblogic 6.1 SP3 on Windows NT. The test client to this servlet opens a new Http session on every request.
    The server containing the servlet does not seem to be releasing memory associated with the session. The server eventually runs out of memory due to this. We verified this with a profiler tool. It shows Strings allocated with ServletRequestImpl.getSession() (weblogic.servlet.internal.session.RSID.getID()) not freed. We have set the session invalidation timeout to 1 min using:
    1) session-timeout=1 in web.xml,
    2) TimeoutSecs=60, InvalidationIntervalSecs=60 in weblogic.xml for the web-app containing the servlet.
    We have also tried setting session.setMaxInactiveInterval(60secs) for the servlet. The latter setting does seem to work as verified from a UI client. We are wondering whether weblogic server is not cleaning up the session even after invalidating it.
    We are not saving any reference to the Http session in our servlet. So we would think that the weblogic server should cleanp the inactive session after 1 min according to the above setting.
    Any help regarding this will be sincerely appreciated. Thanks.
    -Rakesh--
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • ERROR attempting to call HttpSession.invalidate ()  in TOMCAT 5.5.9

    Can someone help me with this TOMCAT issue:-
    I am attempting to implement a logout method that will invalidate the current session and redirect to the login page (based on SRLogout demo eg).
    The code works fine in JDeveloper Embedded OC4J Server, but when i deploy the application to Tomcat 5.5.9 it throws an exception that the Session has already been invalidated.
    I also notice that When i print the session object in JDev it is: 'HTTP Session ac104af6231ccf2bd0e9a39148c5adc1ea2714432a9e' but in Tomcat it is : 'org.apache.catalina.session.StandardSessionFacade@bfb545'
    See the method below and exception below :
    public String logoutButton_action() throws IOException{
    ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContex();
    HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
    HttpSession session = (HttpSession)ectx.getSession(false);
    session.invalidate();
    response.sendRedirect("Login.jspx");
    return null;
    Exception
    [2006-07-18 11:31:01] [ERROR] [http-8080-Processor23] (com.sun.faces.lifecycle.InvokeApplicationPhase:80) - #{backing_app_SRLogout.logoutCommandButton1_action}: javax.faces.el.EvaluationException: java.lang.IllegalStateException: getAttribute: Session already invalidated
    javax.faces.FacesException: #{backing_app_SRLogout.logoutCommandButton1_action}: javax.faces.el.EvaluationException: java.lang.IllegalStateException: getAttribute: Session already invalidated
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
         at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
    ...

    After a lot of investigation, code review and tests, I finally managed to understand what's going on with this problem.
    The following stack trace is the key:
    java.lang.IllegalStateException: getAttribute: Session already invalidated
         org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1077)
         org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
         oracle.adf.share.http.HttpUtil.getAttribute(HttpUtil.java:98)
         oracle.adf.share.http.HttpSessionScopeAdapter.get(HttpSessionScopeAdapter.java:240)
         oracle.adf.share.statemanager.StateManagerScopeAdapter.<init>(StateManagerScopeAdapter.java:88)
         oracle.adf.share.http.HttpStateManagerScopeAdapter.<init>(HttpStateManagerScopeAdapter.java:51)
         oracle.adf.share.http.ServletADFContext.getStateManager(ServletADFContext.java:254)
         oracle.adf.share.statemanager.StateManagerScopeAdapter$ADFScopeListenerImpl.scopeInvalidated(StateManagerScopeAdapter.java:251)
         oracle.adf.share.ADFScopeHelper.fireScopeInvalidated(ADFScopeHelper.java:53)
         oracle.adf.share.http.HttpSessionScopeAdapter.invalidate(HttpSessionScopeAdapter.java:265)
         oracle.adf.share.http.HttpSessionScopeAdapter.valueUnbound(HttpSessionScopeAdapter.java:324)
         org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1686)
         org.apache.catalina.session.StandardSession.expire(StandardSession.java:801)
         org.apache.catalina.session.StandardSession.expire(StandardSession.java:644)
         org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1158)
         org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:150)
    oracle.adf.share.http.HttpSessionScopeAdapter.valueUnbound(HttpSessionScopeAdapter.java:324)*
    org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1686)*
    org.apache.catalina.session.StandardSession.expire(StandardSession.java:801)*
    catalina first invalidate the session by setting expire property to true
    then it removes all attributes by calling removeAttributeInternal()
    which calls whatever attributes valueUnbound method...
    in this case, oracle's HttpSessionScopeAdapter try to get an attribute on the session
    org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
    oracle.adf.share.http.HttpUtil.getAttribute(HttpUtil.java:98)
    catalina does not permit accessing the attributes when it is invalidated... so you get the mighty java.lang.IllegalStateException: getAttribute: Session already invalidated exception...
    the solution to this problem is to remove oracle attributes BEFORE invalidating the session. This should work in any appserver implementation.
    For example, in our case, the oracle attribute was a scope attribute (HttpStateManagerScopeAdapter in our stack trace)... We found those attributes using the
    HttpSession.getAttributeNames() method, and removed them manually before invalidating the session.
    session.removeAttribute("ORA_adf_sessionScope");
    session.removeAttribute("__adf_session_scope__");
    // remove private attributes
    // and invalidate the session
    session.invalidate();
    I think that it makes sense that catalina invalidates the session before any call to the listeners, because any problem in those attributes could mean an improperly invalidated session...
    Cheers.

  • (ejb 3.0) stateful session facade?

    Hello,
    (1) Would you consider stateful session facade (whose client is a servlet) a bad design?
    (2) How to have a stateful session facade referenced in a servlet? I am using Sun Application Server Platform Edition 9.0 and trying to make an injection:
    @EJB(name="ejb/KOGSessionFacade")
    protected KOGSessionFacade sessionFacade;
    but then I get this error in deploy-time: "A stateful session bean can not be injected into a servlet. Please refer to EJB 3.0 Persistence API Specification section #5.2 for further information."
    Thanks.

    Using a Stateful Session facade from a Servlet is not necessarily a bad design. In some cases, you may want to do some cleanup work on completion of a transaction. Stateful Session beans provide a convenient way (By implementing SessionSynchronization interface) to do this.
    In the servlet programming model, Servlets are not designed to be single threaded. So if you inject a StatefulSessionBean (SFSB) references then multiple threads could be possibly be invoking the SFSB concurrently. In this case, the EJBContainer (as required by the specification), will throw a well defined exception.
    What you may want to do is to place this SFSB reference into you Servlet session.

  • EJB 3.0 Stateful - Setting session timeout in configuration

    Hello Everyone,
    I am working with EJB v3.0 and Glassfish as the app server. In case of Stateful EJB, when we explicitely annotate a method with '@Remove', the bean instance is removed from the container when this method is invoked from the client. However, I just wanted to know if there is any way so that I can override the session timeout value (in configuration or via annotations) such that if no client calls this instance for some configured time, the bean is removed by the container automatically.
    Regards,
    San

    Using a Stateful Session facade from a Servlet is not necessarily a bad design. In some cases, you may want to do some cleanup work on completion of a transaction. Stateful Session beans provide a convenient way (By implementing SessionSynchronization interface) to do this.
    In the servlet programming model, Servlets are not designed to be single threaded. So if you inject a StatefulSessionBean (SFSB) references then multiple threads could be possibly be invoking the SFSB concurrently. In this case, the EJBContainer (as required by the specification), will throw a well defined exception.
    What you may want to do is to place this SFSB reference into you Servlet session.

  • A simple problem with sateful Session beans

    Hi,
    I have a really novice problem with stateful session bean in Java EE 5.
    I have written a simple session bean which has a counter inside it and every time a client call this bean it must increment the count value and return it back.
    I have also created a simple servlet to call this session bean.
    Everything seemed fine I opened a firefox window and tried to load the page, the counter incremented from 1 to 3 for the 3 times that I reloaded the page then I opened an IE window (which I think is actually a new client) but the page counter started from 4 not 1 for the new client and it means that the new client has access to the old client session bean.
    Am I missing anything here???
    Isn�t it the way that a stateful session bean must react?
    This is my stateful session bean source.
    package test;
    import javax.ejb.Stateful;
    @Stateful
    public class SecondSessionBean implements SecondSessionRemote
    private int cnt;
    /** Creates a new instance of SecondSessionBean */
    public SecondSessionBean ()
    cnt=1;
    public int getCnt()
    return cnt++;
    And this is my simple client site servlet
    package rezaServlets;
    import java.io.*;
    import java.net.*;
    import javax.ejb.EJB;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import test.SecondSessionRemote;
    public class main extends HttpServlet
    @EJB
    private SecondSessionRemote secondSessionBean;
    protected void processRequest (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    response.setContentType ("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter ();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet main</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Our count is " + Integer.toString (secondSessionBean.getCnt ()) + "</h1>");
    out.println("</body>");
    out.println("</html>");
    out.close ();
    protected void doGet (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    processRequest (request, response);
    protected void doPost (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    processRequest (request, response);
    }

    You are injecting a reference to a stateful session bean to an instance variable in the servlet. This bean instance is shared by all servlet request, and that's why you are seeing this odd behavior.
    You can use type-leve injection for the stateful bean, and then lookup the bean inside your request-processing method. You may also save this bean ref in HttpSession.
    @EJB(name="ejb/foo", beanName="SecondBean", beanInterface="com.foo.foo.SecondBeanRemote")
    public MyServlet extends HttpServlet {
    ic.lookup("java:comp/env/ejb/foo");
    }

  • Vi session strategy with LV 7 in Test Stand

    Hi all, Im a producing a set of vi's(LV7.1) which will be strung together in a Open Visa, Write visa ..., Read visa , Close visa, over several instruments.
    I wish later to use Test Stand(3.1) to slice these routines, but I am not sure how test stand handles the session references when I break the flow.
    Im thinking of a first step that initialises all instruments , then later steps that grab the session references and perform tests.
    Do I need to store the sessions as varables in Test Stand?, or is there a better way?.Is there any examples that cover this topic?
    thanks

    I guess that a better way is NI Session Manager.
    NI Session Manager is the software component (of NI TestStand) from which you obtain instrument sessions. Session Manager returns a reference to the session object with the name you specify. If the session object you specify does not yet exist, Session Manager creates it and returns a reference to the new session.
    Session Manager also allows you to close all opened sessions automatically.
    "Only a life lived in the service to others is worth living..." - Albert Einstein
    Attachments:
    SMgrRef.chm ‏121 KB

  • Session variables dropping

    I've been having this problem for a long time so I thought
    I'd post again and maybe get a hit this time.
    We run off windows cfmx 7.x now fully patched, prior to that
    we were on cfmx 6.x. We use session management only. Many times on
    a new page hit the user loses about half of their session variables
    up to all of them. Typically we have them test on the same machine
    using different browsers. 99% of the time switching from IE to
    firefox solves the problem, most of the users have had IE 6.x.
    I experienced this problem myself for about 4 months time and
    I could reproduce it daily when neccessary by simply opening a new
    window to our application and the session information would persist
    to the new window but the parent window would receive a new cfid
    and lose all session information. New windows aren't the only
    issue, we see a lot of lost session variables in one click, same
    window, functionality. I've had hooks in place to test if the
    domain was different on page hits removing the www or something but
    so far have not found anything there. Each time a new CFID is being
    issued and they are losing the original. We attempted to put CFID's
    in the URL at all times but that leads to other issues and didn't
    solve the problem for us anyhow.
    This has been a serious issue for awhile and browsing these
    forums I see others are experiencing it to some extent too. I'm
    wondiner if anyone has any tips or can confirm the CF Admin/app.cfc
    setup you use if you're not seeing any problems like this.

    right... response.sendRedirect(). sendRedirect works by sending a repsonse to the browser with a location header. The browser sees that header and makes a new, separate request to the new location. It's no different then typing the location in the location bar in the browser or clicking a link.
    But that doesn't matter. If you have 2 web applications (aka 2 servlet contexts) on the server, they are not going to share sessions between them. So the first page is working off one session in one context with some ID. Then the redirect sends it to another page in a different context. That session ID is not valid in that 2nd context, so a new session is created like it was a first time user. And if you redirect back, you may not get the same session for the first context, unless the session ID cookie defines the path as well (I'm not sure offhand).
    The "application" object is the servlet context, specifically a javax.servlet.ServletContext object (or implementation of the interface, technically). Nothing is shared between contexts.
    Now, you can always share things in one way or another. Store things in a database or in files. Use a messaging system like SOAP or JMS. Maybe the server allows for contexts to access each other (they aren't shared in that case, just that you can get a named context and read what's stored in it).
    Or don't have your separate contexts, use subdirectories in the same context.

Maybe you are looking for