In a typical Java EE application, persistence services reside in their own archive. They are referred to as an EJB JAR (Enterprise JavaBean JAR). In order to let our web application (the View and Controller) and the persistence services (the Model) easily work together, both the EJB JAR and our previously-generated WAR are wrapped within a single Enterprise Archive (EAR). So let’s first create a skeleton EJB JAR and EAR.
An EJB JAR is nothing more than a simple JAR that contains Java classes in a package structure. What distinguishes an EJB JAR from a normal JAR is the fact that there are some extra files in the META-INF
directory inside the JAR file. In a normal JAR file, this directory only contains the MANIFEST.MF
file. In an EJB JAR, the META-INF
directory also contains some extra files. See the following table for an overview:
Filename |
Mandatory |
Description |
---|---|---|
|
mandatory |
Nothing special compared... |