3 Replies Latest reply on Jun 28, 2011 1:18 PM by tomj

    Getting Session Information & User credentials using FlexContext

    Deep_1234

      Hi,

       

      I am working with sessions and authentication for the first time.
      I need assistance with using FlexContext to read the session attributes and user
      Information. I want to know, how and from where FlexContext gets the session
      information from? I have a flex login page, the user id and password are
      submitted via URLVariables - j_username and j_password. The Tomcat validates it,
      using custom JDBCRealm. I now want to capture this user information as well as
      the session details, such that it is accessible at both the Flex as well as the
      Java side. I have a java class, in which I am trying to access the
      HttpServletRequest object and FlexSession object, by doing something like this -

       

      HttpServletRequest req = FlexContext.getHttpRequest();
      FlexSession session = FlexContext.getFlexSession();

       

      But both of these throw NullPointerException.

       

      Any pointers on how to resolve this issue, would be highly appreciated.

       

      Thanks & Regards,
      Deepa

        • 1. Re: Getting Session Information & User credentials using FlexContext
          fegolder

          I am also experiencing this same thing.  It happens using both the 3.2.0.3978 turnkey and 3.3.0.8456 turnkey.  further FlexContext.getUserPrinical() also throws a null pointer exeception

          SEVERE: Servlet.service() for servlet jsp threw exception
          java.lang.NullPointerException
                  at flex.messaging.FlexContext.isPerClientAuthentication(FlexContext.java:319)
                  at flex.samples.product.ProductService.getProducts(ProductService.java:35)
                  at org.apache.jsp.testdrive_002dhttpservice.catalog_jsp._jspService(catalog_jsp.java:62)
                  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
                  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
                  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:290)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.ja va:584)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                  at java.lang.Thread.run(Thread.java:595)

           

          Opening the source line 319 the only place I see where a null pointer can get thrown would be getting the message broker.  Any assistance would be great.

          • 2. Re: Getting Session Information & User credentials using FlexContext
            bcuthb56

            Did you get this issues solved? I am having the same issue.

            • 3. Re: Getting Session Information & User credentials using FlexContext
              tomj Adobe Employee

              Yes, they were resolved. Protective code was added to these methods in 2009 to handle the case where no MessageBroker is available.

               

              You are using an old version of LCDS.

               

              Tom