Search code examples
javasessiontomcatweblogic

Accessing session attributes in weblogic vs tomcat


I have a web application where I want to track which language a user wants to use to view the various pages. I am using a session attribute to store their selection. I set the session attribute like so...

String languageChosen = request.getParameter("LANG");
request.getSession().setAttribute("LANG", languageChosen);

Then in other methods I retrieve the attribute like so...

String languageChosen= (String) request.getSession().getAttribute("LANG");

When I test this application in my local environment - which is running Tomcat - it works perfectly. But when I deploy the application to our remote development server - which is Weblogic - the session attribute is not being captured. As a result the application is not displaying in the right language.

Should I be storing the session attribute differently for Weblogic? I've never run into this issue before. We have other apps running on the same Weblogic instance that utilize session attributes without issue. Any ideas?


Solution

  • I figured out the problem. The current development URL is not a secure URL and I had the secure cookie setting set to TRUE in my weblogic.xml file. Once I changed it to FALSE everything worked.

    Now I just have to remember to change it back to TRUE when we move to a secure environment. Ha ha!!