3 Replies Latest reply on Aug 6, 2002 7:52 AM by adrian.brock

    Local interfaces and web applications

    yyop

      Hello,

      I have two independent files: one .jar with the EJB's and one .war with the web application. They are deployed individually and I want to access the local interfaces of the EJB's defined in the .jar from the servlets defined in the web application.

      Somebody knows if this is possible?

      I'am using the Jboss 3.0 / Tomcat 4.0.3 bundle.

      Thanks in advance,
      bye

        • 1. Re: Local interfaces and web applications

          Yes you can do this.

          You will have to lookup the local interface in jndi.
          It is bound by default at local/<your-ejb-name>

          The only method currently to make a dependency between
          the two is to put them in an ear.

          If you deploy individually and change the ejb jar
          you will get ClassCastExceptions if you don't restart
          the web app.

          Regards,
          Adrian

          • 2. Re: Local interfaces and web applications
            yyop

            Hello,

            Thanks for your response. It's already running, without problems (at least, at first sight).

            Another question, although some posts says that Facade pattern is useless with local interfaces I think that its better to maintain a session layer between the servlets and the entities. I think that I can use the Data Transfer Object pattern to send data from servlet to entity (through a session bean) and use the local objects to display data at JSP's / Servlets (without the DTO's).

            Is the previous architecture logical? or, am I losing the advantages of the local interfaces (by using a facade pattern)?

            Again, thanks in advance,
            Bye


            • 3. Re: Local interfaces and web applications

              The facade pattern is fine.

              In general you should split your app into three layers
              although this might be overkill for small apps.

              presentation (servlet/jsp/other)
              business logic (SLSB facade)
              persistence (entities with caching, locking, etc.)

              The other advantage of the facade is to combine
              multiple entity accesses into one transaction.

              Regards,
              Adrian