Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Session Data Crossover Issue! Please Help !!!

Thread view: 
varlagas@yahoo.com - 25 May 2007 12:56 GMT
I am experiencing a session data crossover issue (immediately after
logging on to the application, user A views the session data of user
B). I have investigated the issue up to a particular point - by also
adding some pertinent logging to the application - and it appears
that, while the session is correctly populated with the user data and
the servlet/POJO level, *after forwarding to the JSP, the JSP grabs a
wrong session....* ?? :-o

Please note that this is an application that run for four (4) years
now in production, and the problem starting occurring without any
change is the session management code of the app... Could it be a
caching issue? It happen non-deterministically to *some* users...

The relevant code snippets are as follows:

*** CONTROLLER SERVLET ***

public class ControllerServlet extends HttpServlet {
...
   public void doPost(HttpServletRequest request,
HttpServletResponse
response)
           throws javax.servlet.ServletException,
java.io.IOException
{
       performTask(request, response);
   }
...
   public void performTask(HttpServletRequest request,
           HttpServletResponse response) throws ServletException {
       // Make sure we are logged in, if not forward to login page
       HttpSession session = request.getSession(false);

       if (commandName.equals(loginCommand)) {

        ...
        resultPage = getCommand(commandName).execute(request,
response,
                       session);
        ...

        //Forward to the result page
        RequestDispatcher rd =
getServletContext().getRequestDispatcher(
                   resultPage);
       ...
       }
   }

}

*** POJO used by servlet***

public class LoginCommand extends DefaultLogger implements Command {

   ...
   public String execute(HttpServletRequest request,
           HttpServletResponse response, HttpSession session) {

      // Get the parameters from the request
       String id = request.getParameter(PARM_USER).toUpperCase();
       String pass = request.getParameter(PARM_PASS).toUpperCase();

      ...

           // Login if we get a valid ID
           logInfo("Authenticating user " + id);
           LogonUser logonUserProcess = new LogonUser();
           logonUserProcess.setUserId(id);
           logonUserProcess.setPassword(pass);
           UserData userData = (UserData) logonUserProcess
                   .execute(icbsSystemDate);

           //The user is authenticated
           // Create a new session if needed
           if (session == null) {
               logInfo("Creating HTTP session");
               session = request.getSession();
           }

           // Save the user information in the session
           session.setAttribute(CommandConstants.ATTR_USER, new
UserView(
                   userData));
           // *** at this point the user data are correct,
           //      i.e. if it is user A that is attempting to log
on,
           //           then user A data are saved, _always_ ***

          ...
          return CommandConstants.PAGE_WELCOME;

   }

   ...

}

*** JSP ***

...

<jsp:useBean id="user" type="ZZZ.webapp.view.UserView"
scope="session"/

...

<jsp:getProperty name="user" property="userId"/>
//*** SOS SOS The problem lies here; *sometimes* (not always) the
user
id of a different user is shown, even the the user data of the
correct
user were just put into the session *** Could it be a problem in the
JSP, or some page caching issue ??? ***

THX!!!!
TobiMc3@gmail.com - 25 May 2007 20:20 GMT
On May 25, 7:56 am, varla...@yahoo.com wrote:
> I am experiencing a session data crossover issue (immediately after
> logging on to the application, user A views the session data of user
[quoted text clipped - 112 lines]
>
> THX!!!!

Kind of a dumb question, but, what else changed with the application?
What application server is being used? Did the configuration of that
change? (like now the application is using a clustered configuration
for example?)

Tobi


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.