Packaging your module with EJB backend conversion

This task is applicable if you created an EJB JAR file that is being deployed to target WebSphere Commerce Server that uses a different type of database from your development environment.

About this task

To package an entire module, such as an EJB JAR file, for deployment, follow these steps. Note that if your EJB JAR file only contains session beans, then you do not have to complete these steps and can go directly to deploying the entire module.

Procedure

  1. Open the WebSphere Commerce Developer and switch to the Java EE perspective.
  2. Expand the EJB project that contains the bean or beans that you are deploying:
    • If you have created new enterprise beans, expand the WebSphereCommerceServerExtensionsData project (or the name of a new custom EJB project that contains the changes).
    • If you have modified WebSphere Commerce entity beans, expand the project that contains the modified bean. For example, if you have modified the User bean, expand the Member-MemberManagementData EJB project.
  3. Double-click the Deployment Descriptor icon to editing the deployment descriptor.
  4. With the Overview tab selected, scroll to the bottom of the pane, to locate the JNDI - CMP Connection Factory Binding section.
  5. Record the value in the JNDI name field. You will restore this value after exporting the EJB JAR file.
  6. In the JNDI name field, enter the data source JNDI name of the target WebSphere Commerce Server. For example:
    • DB2jdbc/WebSphere Commerce DB2 DataSource demo where the target WebSphere Commerce Server is using a DB2 database, and the WebSphere Commerce instance name is "demo"
    • Oracle jdbc/WebSphere Commerce Oracle DataSource demo where the target WebSphere Commerce Server is using an Oracle database, and the WebSphere Commerce instance name is "demo"
    • For IBM i OS operating systemjdbc/WebSphere Commerce iSeries DataSource demo where the target WebSphere Commerce Server is using a DB2 UDB for iSeries database, and the WebSphere Commerce instance name is "demo"

    Tip: The value for the DataSource JNDI name field is created by adding "jdbc/" to the data source name of the target WebSphere Commerce Server. You can verify the data source name by opening the WebSphere Commerce configuration file on the target WebSphere Commerce Server and searching for DatasourceName= in the file. Important: If you specify a different data source for your custom enterprise beans than that used by the WebSphere Commerce enterprise beans, a two-phase commit will be required. Therefore, if your custom enterprise beans use the same database as the WebSphere Commerce enterprise beans, you must use the same data source name, so as to avoid a two-phase commit. In general, the use of two-phase commit JDBC drivers with WebSphere Commerce is not recommended.

  7. Save your deployment descriptor changes.
  8. Close WebSphere Commerce Developer.
  9. At a command prompt, navigate to the following directory:
    
    WCDE_installdir\bin
    
  10. Enter the following command:
    
    ejbConvert.bat projName jarName [mapType]
    
    Where:
    projName
    The project to be deployed
    jarName
    The name of the EJB JAR file to create
    mapType
    Oracle

    The following is an example usage of this command with all values specified:

    
    ejbConvert WebSphereCommerceServerExtensionsData WebSphereCommerceServerExtensionsData.jar 
    The ejbconvert.bat command expects the input to be a DB2 back end.
  11. Open WebSphere Commerce Developer and open the EJB deployment descriptor and restore the modifications that were made previously, back to the setting that is required for your local test server. Save your changes.
  12. If you are collecting all assets to be deployed into a single directory (for example C:\ExportTemp), copy the newly created EJB JAR file into that directory.