Deployer Responsibilities

   

Packaging EJBs

EJBs and their deployment descriptor are passed between the EJB roles and eventually deployed using an ejb-jar file. This JAR file contains

  • The home and component interfaces

  • The bean implementation classes

  • Any custom primary key classes

  • All dependent classes and interfaces

  • The ejb-jar.xml deployment descriptor (stored in a META-INF subdirectory relative to the root of the JAR)

  • Any vendor-specific deployment descriptors

As a bean provider, you can create an ejb-jar file by following these steps:

  1. Compile your EJBs and their supporting classes and interfaces

  2. Define the required parts of the deployment descriptor(s) and copy these files to a META- INF directory that's parallel to the root directory of your package hierarchy. For example, if your root package is com and your class files are compiled into a directory structure starting at c:\examples\classes\com , you should place your deployment descriptors in c:\examples\classes\META-INF . Your container vendor may specify a different location for any vendor-specific descriptors.

  3. Create a new JAR file that holds the class files and descriptors using the jar command. For example, building a JAR that holds all the classes under a com directory (and its subdirectories) and the deployment descriptors could be done using the following line:

     jar cf auction.jar META-INF com 

The preceding example creates a new JAR file that contains the deployment descriptors and all class files under the com directory. If that includes files you don't need in the JAR, you can restrict the contents using path specifications such as

 com\que\ejb20\auction\model\*.class. 

The ejb-client File

The EJB specification also defines the concept of an ejb-client JAR file. This is a JAR you can create that holds only the class files that a client application needs to access the beans included in a corresponding ejb-jar file. This JAR would include the home and component interfaces, any primary key classes, any custom application exceptions exposed to the client, and the client stubs generated by the container. If you create this file, you can reference it in the ejb-client-jar element of ejb-jar using a pathname relative to the location of the ejb- jar file. The EJB specification doesn't dictate any required support for this file by an application server, but it is a convenient way for you to package the class files needed to deploy your client applications.



Special Edition Using Enterprise JavaBeans 2.0
Special Edition Using Enterprise JavaBeans 2.0
ISBN: 0789725673
EAN: 2147483647
Year: 2000
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net