Search code examples
javaeclipsejakarta-eeejbejb-3.1

Understanding the directory structure / modules which gets created in EJB 3.x


I have created a simple EJB 3.1 project using eclipse IDE, and below is the layout of the project:

enter image description here

I created a simple Session Bean (stateless) and the above is the directory structure.

I have read books (to the extend needed) on EJB 3.x, but no where there is any mention of all this directory structure.

Can anyone help me understand the logical relation of these directory structure and how can I learn it in an easy-to-understand without cramming the things.


Solution

  • What you get with Eclipse is the structure that suits Eclipse. If you create the same with Netbeans or IntelliJ you will likely get another directory structure, or if you use Maven you get another (customizable) structure.

    What is important is the final build. If you export your project in Eclipse you will get the standard deployable structure conform to JEE specification.

    To reassume, each vendor (Eclipse, Netbeans...etc) has its own way to arrange things and it is detailed in the corresponding manual. But every vendor must adhere to specifications when producing the final build.

    Then few things about your screenshot:

    FirstEJBProj

    where your EJBs reside, ejbModule is where Eclipse keep source code (Java file).

    FirstEJBProjClient

    here you will find the business interfaces implemented by the EJBs, that you can pack and distribute to your client, remote or local. Again ejbModule is where all your classes are. Also, I don't know why Eclipse creates it as an EJB project, a Jar would be enough.

    FirstEJBProjEar

    Just the ear container that gather all.

    Am I answered your question ?