7 Replies Latest reply on Mar 18, 2009 1:38 AM by peris

    Session Problem

      Jboss server 4.2.2.GA
      Jboss portal 2.7.0


      I have created some user name and pasword in jboss portal. Based on the user name and password I have forwarded the user to their particular portal. I can get the user details in the following jsp files.

      C:\jboss-4.2.2.GA\server\default\deploy\jboss-portal.sar\portal-core.war\WEB-INF\jsp\tabs.jsp.

      In the above file I set the user name in session object ( session.setAttribute("userName" , userName) ). I tried to get this session value in portlet jsp file using the following way.

      1 ) session.getAttribute("userName");

      2 ) String) Navigation.getPortalRuntimeContext().getSession().getAttribute("userName");

      3) (String)renderRequest.getPortletSession().getAttribute("userName");

      But I got only null values. I dont know how to set the value in session in tabs.jsp and get that value from session in portlet jsp files. I f you have any idea please share with me.

        • 1. Re: Session Problem

          This is very urgent one. I am expecting any ones reply.

          • 2. Re: Session Problem
            fuchs

            I think, its default not allowed. Use this:

            <session-config>
             <distributed>true</distributed>
            </session-config>
            


            in the jboss-portlet.xml.
            i found this in the jboss portal reference guide, so iam not sure if it solve the problem.

            • 3. Re: Session Problem

              First, as an FYI: it usually doesn't help get responses to your forum requests by explaining the urgency of your problem. If someone has time to help, they will.

              Second, the problem you're seeing is a result of setting a session attribute in the portal-server.war web application and trying access it from your custom portlet WAR web application. These sessions aren't implicitly shared.

              Also, I'm not sure if you'd want to write custom code (especially setting session values in a JSP) to store/access user information. Is there a problem with using the standard JAAS principal?

              renderRequest.getUserPrincipal()


              • 4. Re: Session Problem

                Note that Fuchs's solution mentioned below enables session-replication for setting up JBoss Portal in a clustered environment; it does not solve the problem of attempting to access session attributes across web applications.

                • 5. Re: Session Problem
                  fuchs

                  Excuse me, you right apemberton. I didnt saw, that the session-config is only for cluster environments.
                  I also use the JAAS principal.

                  • 6. Re: Session Problem

                    No worry, fuchs - just trying to be helpful. =)

                    • 7. Re: Session Problem

                      Hi friends , I got the solution from your help

                      renderRequest.getUserPrincipal() - this code is solved my problem

                      but previously I used
                      "Principal principal = (Principal)request.getAttribute"org.jboss.portal.header.PRINCIPAL");" , so I got only null value.



                      Fuchs - I tried using

                      <session-config>
                      true
                      </session-config>

                      in the jboss-portlet.xml, but i cant get the session attributes across web applications.

                      Thankyou apemberton and Fuchs..