EJBs are packaged in a JAR file. Web applications are packaged in a Web Application aRchive (WAR). If EJBs are to be accessed remotely, then the client needs to have access to business interfaces. Therefore, EJB business interfaces and shared objects are packaged in a separate JAR, called EJB client JAR. Furthermore, if EJBs and web applications are to be deployed as one single application, then they need to be packaged in an EAR.
So, in most cases the application with EJBs is not a single project, but four different projects:
- EJB project that creates EJB JAR
- EJB client project that contains business classes and shared (between EJB and client) classes
- Web project that generates WAR
- EAR project that generates ...