EJB JAR Files
An EJB JAR file represents the deployable JAR library that contains the server-side code and configuration of the EJB module. During deployment, the ejb-jar.xml file is placed in the META-INF directory of the EJB JAR file. Any entity and session beans defined within the ejb-jar.xml file must have the .class files for their implementations, home interfaces, and remote interfaces, as well as any dependent classes, archived inside the EJB JAR file. As you'll see later in this article and other articles, the ejb-jar.xml file can be used to define references to other EJBs in other EJB JAR files from EJBs defined in the current EJB JAR file. If the Class-Path attribute in the EJB JAR file's Manifest.mf file includes any auxiliary EJB JAR file library URLs, then the current EJB JAR file does not need to include any EJB client stubs or interfaces from any associated auxiliary EJBs on which its EJBs are dependent.
Any client stub and interface classes needed to access the EJBs in a particular EJB JAR file can be placed in a separate EJB client JAR file. The URL of this EJB client JAR file can then be specified in the ejb-jar.xml file's <ejb-client-jar> element. Any EJB clients of the EJBs in the associated server-side EJB JAR file can then automatically receive downloaded interface and stub classes as they are needed if the EJB client's class loader can reach the URL defined within the <ejb-client-jar> element. If no automatic class-downloading mechanism is supported or used by the client, the EJB client JAR libraries should be installed on the EJB client's machine.