Announcement Announcement Module
Collapse
No announcement yet.
Migration existing EJB out Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Migration existing EJB out

    Hi

    We have a existing application which is based on EJB (all Stateless). We would like to move them out of the EJB container and run under Spring. We wanted to do this so that we don't have overhead of EJB and also get other advantages of Spring.

    Please let me know what is the best option for doing the same, so that we can spend minimum effort in the migration of the existing EJB.

    Ganesh

  • #2
    Interestingly enough, your components won't "run" under Spring. They have to be hosted by a particular container, whether it be your existing container, Tomcat or another.

    What Spring does is create your components and provide services like transaction management. Spring is a really fancy object factory and utility library. Its not a container in the traditional J2EE sense.

    I feel the need to mention this because I've seen confusion in this area.

    IMO, the first step to migrating an EJB based application is to create non-EJB interfaces from the EJBs interfaces. At that point you can change your client components to use these interfaces. Since you are using an interface in your client code, you can do unit testing mocking your service classes' interface. You also can start porting the EJB code into POJO code. Leave out transaction management (it can be added using Spring XML without changing your code) and other such concerns.

    Once you have ported your EJBs and your client code no longer depends on the EJBs, it a matter of getting it to work. I would suggest unit/integration tests first before you hook everything up.

    Comment


    • #3
      Thanks for the reply. But this would mean too many changes both in the client side as well EJB side, just wondering is there an easier way to do this. Maybe not, but just to check with you before going down this route.

      Comment


      • #4
        You CAN implement your business services using your EJB interface. Since preserving the current interface appears to be important, the biggest change would be on the server side. Basically you could refactor your components so that the EJB layer is a thin wrapper around the actual business login in the non-EJB object, using Spring to wire it up. The reference manual should conver how to implement EJBs using a thin wrapper delegating to a POJO.

        Comment


        • #5
          Originally posted by wpoitras View Post
          The reference manual should conver how to implement EJBs using a thin wrapper delegating to a POJO.
          Does this mean that we would have EJBs after migration as well? we really want to do away with EJB container usage altogather.

          Ganesh

          Comment

          Working...
          X