1 Reply Latest reply: May 12, 2013 1:32 PM by gimbal2 RSS

    Separating web layer and EJB layer and deploying on different servers

    1008413
      Hi,

      Web Layer - JSP/Servlets
      Business Llayer - EJB 3

      I want to develop separate projects for web layer (.war) and for Business layer (.jar). I want to deploy these layers on different Glassfish servers.

      Here is my Approach -

      1. Create a separate module for remote interfaces (.jar), use @remote annotations
      2. Create a Web module using JSP/Servlets (.war) and use this remote interface jar in it.
      3. Create a EJB module (.jar) and implement these remote interface in it.
      4. Use JNDI in Web layer to access the EJB methods.

      I want to know if this is the correct approach?
      Is there any better approach in Java EE 6? Is there any good example which explains this?

      regards,
      dattatray.
        • 1. Re: Separating web layer and EJB layer and deploying on different servers
          gimbal2
          1005410 wrote:
          I want to know if this is the correct approach?
          It is the ONLY approach you can take with EJBs.
          Is there any better approach in Java EE 6? Is there any good example which explains this?
          Sure, use webservices in stead of EJBs directly. In my experience that is more portable and far easier to deploy as you don't need server specific EJB client jars. Check out JAX-WS and JAX-RS (me personally I prefer JAX-RS as it is a very clean API and a more well-defined standard).