One of the most important features of EJB is that beans should work with containers from different vendors. That doesnât mean that selecting a server and installing your beans on that server are trivial processes. Weâll start this chapter with a general discussion of how you select and set up a server.
The EJB server you choose should be compliant with the EJB 1.0 or EJB 1.1 specification. However, in the EJB 1.0 version of the specification, support for entity beans and container-managed persistence is optional. In EJB 1.1, support for entity beans is required. The first example in this chapterâand most of the examples in this bookâassume that your EJB server supports entity beans and container-managed persistence. The EJB server you choose should also provide a utility for deploying an enterprise bean. It doesnât matter whether the utility is command-line oriented or graphical, as long as it does the job. The deployment utility should allow you to work with prepackaged enterprise beans, i.e., beans that have already been developed and archived in a JAR file. Finally, the EJB server should support an SQL-standard relational database that is accessible using JDBC. For the database, you should have privileges sufficient for creating and modifying a few simple tables in addition to normal read, update, and delete capabilities. If you have chosen an EJB server that does not support an SQL standard relational database, you may need to modify the examples to work with the product you are using.
To get the most from this chapter, it helps to have an IDE that has a debugger and allows you to add Java files to its environment. Several Java IDEs, like Symantecâs Visual Cafe, IBMâs VisualAge, Inpriseâs JBuilder, and Sunâs Forte, fulfill this simple requirement. The debugger is especially important because it allows you to walk slowly through your client code and observe how the EJB client API is used.
Once you have an IDE set up, you need to include the Enterprise
JavaBeans packages. These packages include
javax.ejb and for EJB 1.0
javax.ejb.deployment. You also need the
JNDI packages, including
javax.naming.spi. In addition, you will need the
javax.rmi package for EJB 1.1.
packages can be downloaded from Sunâs Java site
(http://www.javasoft.com) in the form of ZIP or
JAR files. They may also be accessible in the subdirectories of your
EJB server, normally under the lib directory.