Administer > Deploy > Deploying customized assets > Customized WebSphere Commerce Enterprise Application (EAR) assets > Deploying custom Java EE assets
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 we 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 WebSphere Application Server 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 the J2EE assets before you deploy.
Procedure
- Deploy using the WebSphere administrative console
- Backup the J2EE assets.
- Place the EJB JAR file containing the changed module either on the machine running WebSphere administrative console or the machine running the Web browser you are using to access the WebSphere administrative console.
- Start the WebSphere Application Server administration server.
- Launch the WebSphere administrative console.
- In the WebSphere administrative console, click Applications > Application Types > WebSphere Enterprise Applications.
- Select the application name and click Update. Your application name will be WC_ instance (for example, WC_demo).
- Select Replace or add a single module.
- In the Specify the path beginning with the installed application archive file to the module to be replaced or added field, type the path and file name to the 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, specify the relative path to the root of the EAR (for example, if the file is called myNewModule.jar, then the relative path and file name would be similar to myNewModules/myNewModule.jar).
- If you are running the WebSphere Application Server administrative console on the target machine, select Local file system, as the files are local to the browser. If you are running the WebSphere Application Server administrative console on a different machine, select Remote file system, as the files are remote to the browser.
- In the Specify the path to the module section, specify the path to the EJB JAR file. For example, drive:\ImportTemp\WebSphereCommerceServerExtensionsData.jar.
- Click Next.
- On the Preparing for the application update page:
- Select Fast Path - Prompt only when additional information is required.
- In the Specify bindings to use field, ensure that merge new and existing bindings is selected; then click Next.
- In the How do to install the application section, check Detailed - Show all installation options and parameters.
- In the Specify bindings to use field, select use new bindings.
- Check Generate Default Bindings.
- Check Override existing bindings.
- Check Default bindings for EJB 1.1 CMP beans. Complete the fields:
Option Description JNDI name Enter the datasource JNDI name of the target WebSphere Commerce Server. For example:
- jdbc/WebSphere Commerce DB2 DataSource instance
- jdbc/WebSphere Commerce Oracle DataSource instance
username Enter the user name of the database user. password and verify password Enter the password of the database user.
Your screen should be similar to the following:
- Leave all other default values and click Next.
- On the Application Security Warnings screen, click Continue.
- Select any steps marked with a star and enter the JNDI name in the appropriate field.
- On the Install New Application screen, click Step 10: Summary.
- A summary of changes displays. Click Finish.
- When the update completes successfully, click Save to Master Configuration.
- On the WebSphere Enterprise Applications screen, click Save to save the changes to the master configuration. All the changes are saved, including updating the store assets, command and data bean file and the EJB jar file.
- Close the WebSphere Application Server administration console.
- To delete assets:
- Back up the changed assets before deploying.
- Start the WebSphere Application Server administration server.
- Launch the WebSphere administrative console.
- In the WebSphere administrative console, click Applications > Application Types > WebSphere Enterprise Applications.
- From the Enterprise Applications list, click the J2EE application for the 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 to delete, and click Remove.
Do not remove any default modules.
- Deploy using the wsadmin tool
- Back up the changed assets before deploying.
- Place the EJB JAR file containing the 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. Verify the 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}
$AdminConfig save
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]')
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]')
AdminConfig.save()
For example:
AdminApp.update('WC_prod','modulefile','[-operation delete -contenturi WebSphereCommerceServerExtensionsData.jar]')
AdminConfig.save()
If the module has resource references or any other configuration, we will need to 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 WebSphere Application Server information center.
Related tasks
Validate changes have been deployed for a custom Enterprise Application (EAR) file
Compiling JavaServer Page files
Related reference