1 Reply Latest reply on May 4, 2006 5:36 AM by rafaelsource

    share an object between diferents war

    rafaelsource

      I want to share an object initiated in one war with oter WAR.
      Can you tell me some solution for this????

      Thanks!!!

        • 1. Re: share an object between diferents war
          rafaelsource

          ok.. i have a solution

          1. Add to the context the object to share in WAR1

          ServletContext sc = session.getServletContext();
          sc.setAttribute("object2Share",objectInstance);
          


          2. In WAR2 access to the context of WAR1 with
          ServletContext sc2 = session.getServletContext();
          sc2 = sc2.getContext("/WAR1");
          


          Is necesary that the both wars have in /WEB-INF/lib the same library (content the class, evident) and the file \deploy\jbossweb-tomcat55.sar\context.xml have the value crossContext="true"

          Thats all Folks!