4 Replies Latest reply on Sep 12, 2014 9:39 AM by pferraro

    Issue trying to share http session between war apps in the same ear file

    marcosfilho

      Hello guys,

       

      I'm working on wildfly 9.0.0.Alpha1 and am trying to share the http session between 2 sample webapps(war) in the same ear.

      I have an ear file with the following structure:

       

      app.ear  

          app1.war

          app2.war

          META-INF/

          META-INF/MANIFEST.MF

          META-INF/jboss-all.xml

       

      note: I have attached the ear file in case you want to check it out

       

      This ear file has been deployed successfully and I can access the pages from /app1 and /app2 via browser.

      However, from the app2 I can not grab the data inserted by the app1 into the session.


      I have configured the file jboss-all.xml as per documentation:

      Web (Undertow) Reference Guide - WildFly 9 - Project Documentation Editor


      my jsp code insert data into the session like this(/app1/index.jsp):


      session.setAttribute("test.name", "Test Attribute List");

        session.setAttribute("test.float", new Float(5.0));

        session.setAttribute("test.int", new Integer(10));

        session.setAttribute("test.Object", new StringBuffer("StringBuffer"));

        session.setAttribute("test.boolean", new Boolean(true));

        session.setAttribute("test.double", new Double(343.1));

       

      and i print  the session date like this:

      for (Enumeration e = session.getAttributeNames(); e.hasMoreElements(); ) {    

          String attribName = (String) e.nextElement();

          Object attribValue = session.getAttribute(attribName);

      %>

      <BR><%= attribName %> - <%= attribValue %>

      <%

      }

      %>


      The problem is:  app2 cant access the session data inserted by app1(and also the other way around).


      I would appreciate very much any help.


      Cheers,

      Marcos