Objective: Describe the packaging and deployment requirements for enterprise beans
Chapter 20 of the JEE5 EJB Core Contracts document fairly succinctly describes how EJB3 applications must be packaged and deployed. Basically, Enterprise JavaBean applications should be deployed at ejb-jar files.
"The ejb-jar ﬁle format is the contract between the Bean Provider and the Application Assembler, and between the Application Assembler and the Deployer. An ejb-jar ﬁle produced by the Bean Provider contains one or more enterprise beans that typically do not contain application assembly instructions. The ejb-jar ﬁle produced by an Application Assembler (which can be the same person or organization as the Bean Provider) contains one or more enterprise beans, plus application assembly information describing how the enterprise beans are combined into a single application deployment unit.
The ejb-jar ﬁle must contain the deployment descriptor (if any) in the format deﬁned in Chapter 19. The deployment descriptor must be stored with the name META-INF/ejb-jar.xml in the ejb-jar ﬁle.
The ejb-jar ﬁle must contain, either by inclusion or by reference, the class ﬁles of each enterprise bean as follows:
• The enterprise bean class.
• The enterprise bean business interfaces, web service endpoint interfaces, and home and com-
• Interceptor classes.
• The primary key class if the bean is an entity bean.
We say that a jar ﬁle contains a second ﬁle “by reference” if the second ﬁle is named in the Class-Path attribute in the Manifest ﬁle of the referencing jar ﬁle or is contained (either by inclusion or by reference) in another jar ﬁle that is named in the Class-Path attribute in the Manifest ﬁle of the referencing jar ﬁle.
The ejb-jar ﬁle must also contain, either by inclusion or by reference, the class ﬁles for all the classes and interfaces that each enterprise bean class and the home interfaces, component interfaces, and/or web service endpoints depend on, except Java EE and J2SE classes. This includes their superclasses and superinterfaces, dependent classes, and the classes and interfaces used as method parameters, results, and exceptions.
The Application Assembler must not package the stubs of the EJBHome and EJBObject interfaces in the ejb-jar ﬁle. This includes the stubs for the enterprise beans whose implementations are provided in the ejb-jar ﬁle as well as the referenced enterprise beans. Generating the stubs is the responsibility of the container. The stubs are typically generated by the Container Provider’s deployment tools for each class that extends the EJBHome or EJBObject interfaces, or they may be generated by the container at runtime."
-From Chapter 20, EJB Core Contracts Docuement