Skip Headers
Oracle® TopLink Developer's Guide
10g Release 3 (10.1.3.1.0)

Part Number B28218-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

10 Deploying a TopLink Application

This chapter includes deployment information on the following TopLink applications:

For more information, see the following:

Java Applications

Build the JAR file (see "Java Applications") and place it on the classpath.

For more information on accessing TopLink from your client application, see Chapter 75, "Acquiring and Using Sessions at Run Time".

JavaServer Pages and Servlets

After you build the WAR and JAR files (see "JavaServer Pages and Servlet Applications"), build them into an EAR file for deployment. To deploy the EAR to your JSP servlet server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

For more information on accessing TopLink from your client application, see "Loading a Session From sessions.xml With an Alternative Class Loader".

Session Bean Applications

After you build the WAR and JAR files (see "Session Bean Applications"), build them into an EAR file for deployment. To deploy the EAR file to your J2EE server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

For more information on accessing TopLink from your client application, see "Loading a Session From sessions.xml With an Alternative Class Loader".

Optionally, you may also consider "Hot Deployment of EJB".

CMP Applications

After you build the WAR and JAR files (see "CMP Applications"), build them into an EAR file for deployment. To deploy the EAR file to your J2EE server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

This section describes the following:

For additional information on server-specific configuration, see Chapter 7, "Integrating TopLink With an Application Server ".

Optionally, you may also consider "Hot Deployment of EJB".

Deploying a CMP Application to OC4J

The most efficient way to deploy a CMP application to OC4J is using Oracle Enterprise Manager 10g. For more information, see Oracle Application Server Administrator's Guide.

When you deploy a CMP application to OC4J, the following happens:

  • OC4J performs a partial EJB conformance check on the beans and their associated interfaces.

  • OC4J builds the internal OC4J classes that manage security and transactions, as well as the RMI stubs and skeletons that enable client access to the beans.

  • TopLink builds concrete bean subclasses and EJB finder method implementations.

Deploying a CMP Application to BEA WebLogic Server

TopLink CMP support includes integration for BEA WebLogic Server. To enable TopLink CMP for BEA WebLogic entity beans, use the WebLogic EJB Compiler (ejbc) to compile the EJB JAR file, as follows:

  • Run ejbc from the command line. Include the EJB JAR file as a command line argument. ejbc creates an EJB JAR file that contains the original classes as well as all required generated classes and files.

When you run ejbc, the following happens:

  • ejbc performs a partial EJB conformance check on the beans and their associated interfaces.

  • ejbc builds the internal BEA WebLogic classes that manage security and transactions, as well as the RMI stubs and skeletons that enable client access to the beans.

  • TopLink builds concrete bean subclasses and EJB finder method implementations.

For more information about running ejbc, see the BEA WebLogic Server documentation.

Troubleshooting ejbc

When you start ejbc, it processes the data in a series of stages. If errors occur while running ejbc, attempt to determine which stage causes the problem. Common problems include the following:

  • Bean classes that do not conform with the EJB specification

  • Classes missing from the classpath (all domain classes, required TopLink classes, and all required BEA WebLogic classes must be on the classpath)

  • Java compiler (javac) problems, often caused by using an incorrect version of the JDK

  • A failure when generating the RMI stubs and skeletons (a failure of RMI compiler (rmic))

Refer to Chapter 15, "Troubleshooting Application Deployment" for additional information.

Deploying a CMP Application to IBM WebSphere Application Server 4.0

TopLink CMP support includes an integration for IBM WebSphere application server 4.0. Use the following procedure to deploy your application to WebSphere applicaton server:

  1. Use the TopLink Deploy Tool for WebSphere to compile the EJB JAR file. For more information, see "Using the WebSphere Deploy Tool".

  2. Start the WebSphere Administration Server.

  3. Start the Administration Console and deploy the compiled JAR file.

For more information about deploying the JAR file, see the IBM WebSphere application server documentation.


Note:

When you deploy an application that contains an entity bean, set up a data source and associate it with the bean. For more information about how to create and associate data sources, see the IBM WebSphere application server documentation.

It is not necessary to deploy the EJB JAR file in WebSphere Studio Application Developer (WSAD), because deployment is carried out using the Deploy Tool (see "Using the WebSphere Deploy Tool").

Starting the Entity Bean

You can start the bean in either the WebSphere application server or in WSAD.

To start the bean in IBM WebSphere application server, do the following:

  1. Select the application that contains the entity beans.

  2. Right-click and choose Start.

A message dialog box appears if the bean starts successfully. If an error occurs, consult Part V, "Troubleshooting a TopLink Application" for troubleshooting information.

To start the bean in WSAD, do the following:

  1. Right-click the EJB project, and choose Run on Server.

  2. To view the status of the process, open the Console tab of the Server view.

BMP Applications

After you build the WAR and JAR files, build them into an EAR file for deployment. To deploy the EAR file to your J2EE server, copy the EAR to a commonly used directory. You may also need to use server-specific deployment tools. For more information, see the server documentation.

For additional information on server-specific configuration, see Chapter 7, "Integrating TopLink With an Application Server ".

Optionally, you may also consider "Hot Deployment of EJB".

Hot Deployment of EJB

Many J2EE containers support hot deployment, a feature that enables you to deploy EJB on a running server. Hot deployment allows you to do the following:

The client receives deployment exceptions when attempting to access undeployed or re-deployed bean instances. The client application must catch and handle the exceptions.

How you configure hot deployment of EJB depends on the type of J2EE application you are deploying:

For more information about hot deployment, see the J2EE container documentation.

Hot Deployment in a CMP Application

When you take advantage of hot deployment in a CMP application, consider the following:

  • You must deploy all related beans (all beans that share a common TopLink project) within the same EJB JAR file. Because TopLink views deployment on a project level, deploy all the project beans (rather than just a portion of them) to maintain consistency across the project.

  • When you redeploy a bean, you automatically reset its TopLink project. This flushes all object caches and rolls back any active object transactions associated with the project.

Hot Deployment in a non-CMP Application

When you take advantage of hot deployment in a non-CMP application, you must refresh the TopLink session using the SessionManager method getSession with the appropriate arguments (see "Refreshing a Session When the Class Loader Changes".

If you do not use this SessionManager method, then your application is responsible for destroying or refreshing the session when a hot deployment (or hot redeployment) occurs.

Using the WebSphere Deploy Tool

TopLink integration for IBM WebSphere application server includes a deployment tool that helps you deploy your projects to WebSphere. The Deploy Tool for WebSphere is a graphical tool that makes project deployment to WebSphere easier to configure and execute. The Deploy Tool also includes a command-line option that lets you deploy your project while bypassing the graphical interface element of the tool.

You can use the Deploy Tool on its own (see "Using the Deploy Tool on its Own") or with the WebSphere Studio Application Developer (see "Using the Deploy Tool With WebSphere Studio Application Developer").

Using the Deploy Tool on its Own

To deploy a JAR file, use this procedure:

  1. Start the WebSphere Deploy Tool by executing the appropriate <TOPLINK_HOME>/bin/wasDeployTool script: on Windows, execute wasDeployTool.cmd; on UNIX, execute wasDeployTool.sh.

    The WebSphere Deploy Tool dialog box appears (see Figure 10-1).

    Figure 10-1 The Deploy Tool Set Up for Use with WSAD

    Description of Figure 10-1 follows
    Description of "Figure 10-1 The Deploy Tool Set Up for Use with WSAD"

  2. Enable the Copy generated source to directory option to save a copy of the generated code in the specified directory. This is a quick and efficient way to copy the files into a WSAD project working directory.

  3. Enable the Turn on tracing option if you want to see the details of the process.

  4. Click Deploy EJB.

Using the Deploy Tool With WebSphere Studio Application Developer

The Deploy tool is compatible with the WSAD.

To deploy from the Deploy Tool to WSAD, do the following:

  1. Select the EJB Project in WSAD and choose to generate Deploy and RMIC Code.

  2. Export the EJB Project to an EJB JAR file, making sure that the TopLink project and toplink-ejb-jar.xml files are included in the EJB JAR file.

  3. Start the WebSphere Deploy Tool by executing the appropriate <TOPLINK_HOME>/bin/wasDeployTool script: on Windows, execute wasDeployTool.cmd; on UNIX, execute wasDeployTool.sh.

    The WebSphere Deploy Tool dialog appears (see Figure 10-1).

  4. Choose the EJB Project working directory so that TopLink overrides the WSAD deploy code with the TopLink deploy code.

  5. If the source is copied to a directory other than the WSAD EJB Project directory, manually copy the source files to the WSAD EJB Project under the ejbModule directory of the project.

  6. Enter appropriate directories in the fields of the Deploy Tool.

  7. Choose Deploy EJB JAR to create the deployed EJB JAR file.

  8. Choose Rebuild all from the Project menu to compile the deploy code to incorporate CMP.

Troubleshooting

The most common error you might encounter when you use the Deploy Tool is the NoClassDefFoundError exception. To resolve this error condition, add the required resources to the Classpath. The Turn on tracing option also helps to debug errors during deployment code generation.

When an obscure error appears during the generating stub phase, copy the Java command and run it at the command prompt. This gives a more detailed error message.

See Chapter 7, "Integrating TopLink With an Application Server " for additional information.