InfoCenter Home >
6: Administer applications >
6.3.v35: Packaging applications and generating code for deployment

6.3.v35: Packaging applications and generating code for deployment

See the Writing Enterprise Beans book for discussions of packaging enterprise beans into applications and generated JAR files for deployment.

Packaging enterprise application files into JAR files for deployment

The person deploying an enterprise application should divide classes belonging to an enterprise application into at least two JAR files. If the application contains both servlets and enterprise beans, these classes should be in separate JAR files. The EJB JAR file should be deployed under an application server container.

The Servlet JAR file should be placed in the Web application "servlets" directory. All EJB helper classes can be either put in the EJB JAR file or can be placed in a separate JAR file which should be placed in the Dependent Classpath of the Administrative Server Node. All Servlet helper classes can be either placed in the Servlet JAR file or in a separate JAR file which should be placed in the Web Application servlets directory.

The following types of classes are exceptions:

  1. Classes which call Java Native Interface (JNI) methods should be placed in the Application Server (JVM)'s classpath.
  2. Classes which are passed to the HTTP session state should be placed in the Application Server (JVM)'s classpath.
  3. Classes which are referenced from both Servlets and enterprise beans, such as method arguments and return values should be placed along with the other EJB helper classes.
  4. Access Bean classes which are referenced from Servlets and which refer to enterprise beans should be placed along with Servlet helper classes.

Generating code for deployment

The administrator deploying enterprise beans should be aware of a couple of special cases.

Considerations for deploying entity beans with CMP

If you are using CMP entity beans that do not rely on a particular database configuration (that is, the beans are not storing data in legacy applications or in existing database tables) you can use the WebSphere Administrative Console to automatically create the deployed JAR file and the corresponding database table.

If you are using CMP entity beans for a legacy application (or the beans are from a third party vendor), you must use VisualAge for Java to create the deployed JAR file. You can then create (install) the bean by using the WebSphere Administrative Console.

It is strongly recommended that you use VisualAge for Java for deploying beans used in legacy applications or beans that require complex mappings to a database table. If you use the automatic deployment process in the console, the order and names of the columns in the generated table are not guaranteed to match the table configuration needed by the legacy application. (The console deployment process makes certain assumptions about the order of container-managed fields.)

If you decide to use automatic deployment within the console, but want to manually create the database table, note the following:

  • The name of the database table must follow the convention EJB.beannameBeanTbl. There is a 14-character limit on the length of table names in DB2.

  • The primary key fields must appear first, and the column headings in the database must match the name and order of the fields as they appear in the deployment descriptor.

An entity bean with CMP must be associated with the name of a data source. A data source specifies a database name, Uniform Resource Locator (URL), network protocol, and location in the Java Naming and Directory Interface (JNDI) namespace.

A data source also references a JDBC driver, used to locate the driver's JAR file on the node. When you create the bean, you are prompted to supply the name of this data source.

Considerations for deploying JAR files with EJB inheritance

Consider the following when deploying JAR files with EJB inheritance:

  • Enterprise beans that participate in an inheritance hierarchy must be deployed in a single JAR file, and you must install and uninstall the inheritance hierarchy as a unit.

  • You must modify the JNDI name of the home for each enterprise bean within the hierarchy. The JNDI name of each bean in the hierarchy must be unique within its container.

Go to previous article: The default resources Go to next article: Installing applications and setting classpaths

 

 
Go to previous article: The default resources Go to next article: Installing applications and setting classpaths