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:
- EJB modules require data sources
- Web modules require context roots and virtual hosts
- Both EJB and Web modules can declare resource references; these must be bound to the actual resources at deployment time
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:
- Backup your J2EE assets.
- 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.
- Start the WAS administration server.
- Launch the WebSphere console.
- In the WebSphere console, expand Applications > Enterprise Applications.
- 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.
- 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.
- Select Single module. More options, specific to an entire module deployment, display.
- 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).
- 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:
- Select Local file system and specify the full path and file name to the EJB JAR file containing all of your changed files.
- Click Next.
- If your EJB JAR file is on the server that your Web browser is connected to to use the WebSphere console:
- Select Remote file system and specify the full path and file name to the EJB JAR file containing all of your changed files.
- Click Next.
- Under Override, select Override existing bindings.
- 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.
- Leave all other options as is and click Next.
- The Application Security Warnings page displays. Click Continue.
- 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:
- Back up your changed assets before deploying.
- Start the WAS administration server.
- Launch the WebSphere console.
- In the WebSphere console, expand Application > Enterprise Applications.
- 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.
- Under Related Items, select the type of module you are working with (for example EJB Modules).
- 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
- Back up your changed assets before deploying.
- Place the EJB JAR file containing your changed module on the file system of the machine running the wsadmin tool
- Start the wsadmin tool.
- 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.
- 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 filesRelated reference
Troubleshoot: Deployment