Deploy J2EE assets for an entire module

The single module option provides the ability to deploy an entire module to the J2EE application. Since there are many different types of modules in J2EE applications the steps can differ depending on the module type. Each module has a deployment descriptor that describes the module itself. When deploying the module you will be asked to provide configuration information for the module. Here are some examples:

The WAS deployment tools will guide you through the process of configuring each module.

The most common types of modules deployed with WebSphere Commerce are EJB modules. Here is the general process to use when deploying EJB modules. The assumption is that you have packaged the EJB modules as recommend. Note that regardless of whether you use the graphical or scripting tools, always back up your J2EE assets before you deploy.

Deploying using the WebSphere console

To add or update assets:

  1. Backup your J2EE assets.

  2. Place the EJB JAR file containing your changed module either on the machine running WebSphere console or the machine running the Web browser you are using to access the WebSphere console.

  3. Start the WAS administration server.

  4. Launch the WebSphere console.

  5. In the WebSphere console, expand Applications > Enterprise Applications.

  6. From the Enterprise Applications list, select the check box next to the J2EE application for your instance. This will be WC_ instance (for example, WC_demo). Click Update.

  7. On the Preparing for Application Installation page, under the Application update options section:

    If you are typing in the directory paths, you should always use forward slashes no matter which platform you are using. You should also not prefix with a leading slash.

    1. Select Single module. More options, specific to an entire module deployment, display.

    2. In the Relative path to module field, type the path and file name to your EJB JAR file. This is the path as it should be in the EAR file. It is relative to the root of the EAR file. Typically, if you are updating an existing module, then the JAR file is at the root of the EAR and only the file name is required. If you are adding a new EJB module, you could place it in a subdirectory of the EAR file. In this situation, you must specify the relative path to the root of the EAR (for example, if your file is called myNewModule.jar, then your relative path and file name would be similar to myNewModules/myNewModule.jar).

    3. Under Upload new or replacement application:

      • If your EJB JAR file is on the same machine as the Web browser used to connect to the WebSphere console:

        1. Select Local file system and specify the full path and file name to the EJB JAR file containing all of your changed files.

        2. Click Next.

      • If your EJB JAR file is on the server that your Web browser is connected to to use the WebSphere console:

        1. Select Remote file system and specify the full path and file name to the EJB JAR file containing all of your changed files.

        2. Click Next.

    4. Under Override, select Override existing bindings.

    5. Under EJB 1.1 CMP bindings, select Default bindings for EJB 1.1 CMPs and specify the JNDI name. The default JNDI name is jdbc/WebSphere Commerce db_type DataSource instance; for example, jdbc/WebSphere Commerce DB2 Datasource demo or jdbc/WebSphere Commerce Oracle Datasource demo.

    6. Leave all other options as is and click Next.

  8. The Application Security Warnings page displays. Click Continue.

  9. The Install New Application wizard opens, with Step 1: Select installation options as the first page. You do not need to specify anything on this page. Click the Summary link on the left navigation frame, and click Finish. WAS saves the updates and deploys the module.

To delete assets:

  1. Back up your changed assets before deploying.

  2. Start the WAS administration server.

  3. Launch the WebSphere console.

  4. In the WebSphere console, expand Application > Enterprise Applications.

  5. From the Enterprise Applications list, click the J2EE application for your instance. This will be WC_ instance (for example, WC_demo). This displays the Enterprise Applications properties, showing the Configurations tab first.

  6. Under Related Items, select the type of module you are working with (for example EJB Modules).

  7. From the list of modules, select the module you want to delete, and click Remove.

    Do not remove any module that are provided by the out of box product; doing so will break the product.

Deploying using the wsadmin tool

  1. Back up your changed assets before deploying.

  2. Place the EJB JAR file containing your changed module on the file system of the machine running the wsadmin tool

  3. Start the wsadmin tool.

  4. Update with the J2EE application with the new module. Ensure that your correctly specify the correct JNDI name of the WebSphere Commerce data source to be used by this module.

  5. Run the following commands depending on the language you have chosen:

    • JACL

      • To add or update assets: $AdminApp update WC_instance modulefile {-operation addupdate -contents path to source module -contenturi path to module in EAR -nodeployejb -usedefaultbindings -defaultbinding.datasource.jndi "datasource JNDI Name" -defaultbinding.cf.jndi "datasource JNDI Name" -defaultbinding.cf.resauth Per_Connection_Factory }

        $AdminConfig save

        For example:

        $AdminApp update WC_prod modulefile {-operation addupdate -contents /deployments/2007-01-01a/WebSphereCommerceServerExtensionsData.jar -contenturi WebSphereCommerceServerExtensionsData.jar -nodeployejb -usedefaultbindings -defaultbinding.datasource.jndi "jdbc/WebSphere Commerce DB2 DataSource prod" -defaultbinding.cf.jndi "jdbc/WebSphere Commerce DB2 DataSource prod" -defaultbinding.cf.resauth Per_Connection_Factory}

        $AdminConfig save

      • To delete assets:

        $AdminApp update WC_instance modulefile {-operation delete -contenturi path to module in EAR}

        For example:

        $AdminApp update WC_prod modulefile {-operation delete -contenturi WebSphereCommerceServerExtensionsData.jar

    • Jython

      • To add or update assets:

        AdminApp.update('WC_instance','modulefile','[-operation addupdate -contents path to source module -contenturi path to module in EAR -nodeployejb -usedefaultbindings -defaultbinding.datasource.jndi "datasource JNDI Name" -defaultbinding.cf.jndi "datasource JNDI Name" -defaultbinding.cf.resauth Per_Connection_Factory]')

        AdminApp.save()

        For example:

        AdminApp.update('WC_prod','modulefile','[-operation addupdate -contents /deployments/2007-01-01a/WebSphereCommerceServerExtensionsData.jar -contenturi WebSphereCommerceServerExtensionsData.jar -nodeployejb -usedefaultbindings -defaultbinding.datasource.jndi "jdbc/WebSphere Commerce DB2 DataSource prod" -defaultbinding.cf.jndi "jdbc/WebSphere Commerce DB2 DataSource prod" -defaultbinding.cf.resauth Per_Connection_Factory]')

        AdminApp.save()

      • To delete assets:

        AdminApp.update('WC_instance','modulefile','[-operation delete -contenturi path to module in EAR]')

        For example:

        AdminApp.update('WC_prod','modulefile','[-operation delete -contenturi WebSphereCommerceServerExtensionsData.jar]')

If your module has resource references or any other configuration, add some additional options to the third parameter. To obtain a list of all options for the module, you can run the following command:

$AdminApp options path to source module

For more information about the AdminApp command, see Commands for the AdminApp object in the WAS information center.

Related tasks

Deploy custom J2EE assets
Validate changes have been deployed for a custom Enterprise Application (EAR) file
Compiling JavaServer Page files

Related reference

Troubleshoot: Deployment