Tutorials > Program model > Add a finder to an existing entity bean

< Previous


Deploy the new code to a target server

In this step we will deploy the changes to a target WebSphere Commerce server by exporting the code from Rational Application Developer, moving the code to the target machine and using WAS to deploy the changes.

You will deploy the following assets:


Procedure

  1. In the Enterprise Explorer view, navigate to...

    EJB Projects | Order-OrderCaptureData

  2. Modify the JNDI name information:

    1. Open Deployment Descriptor: Order-OrderCaptureData.

    2. With the Overview tab selected, scroll to the bottom of the pane, to locate the section...

      JNDI - CMP Connection Factory Binding

    3. In the JNDI name field, enter the datasource JNDI name of the target WebSphere Commerce Server.

      The value for the DataSource JNDI name field is created by adding " jdbc/" to the value of the DatasourceName variable 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. The following values are examples :

      • jdbc/WebSphere Commerce DB2 DataSource demo where the target WebSphere Commerce Server is using a DB2 database, and the WCS instance name is demo.

      • jdbc/WebSphere Commerce Oracle DataSource demo where the target WebSphere Commerce Server is using an Oracle database, and the WCS instance name is demo.

    4. Save the changes and close the file.

  3. From the Order-OrderCaptureData project's pop-up menu, select...

    Export | EJB JAR file

  4. In the Export window, the EJB project name is pre-populated. In the Destination field, enter or browse to a temporary directory that will hold the exported code, for example...

    C:/exporttemp/Order-OrderCaptureData.jar

  5. Click Finish.

  6. After the JAR file has been created, undo the changes to the local deployment descriptor that you made in step 2 to restore the setting that is required for the local test server.

  7. To export the WebSphereCommerceServerExtensionsLogic.jar file:

    1. In the Enterprise Explorer view, navigate to...

      WebSphereCommerceServerExtensionsLogic

    2. From the WebSphereCommerceServerExtensionsLogic project's pop-up menu, select Export.

    3. In the Export window, select Java > JAR File and click Next.

    4. In the JAR file window, expand WebSphereCommerceServerExtensionsLogic.

    5. Deselect Export Java source files and resources if you do not want to deploy the source code to the target server. The source code is not necessary on the target server.

    6. In the right pane, ensure that resources that begin with a period are not selected. For example:

      • .classpath

      • .classpath.template

      • .project

      • .serverPreference

    7. In the JAR file field, enter drive:/path/ WebSphereCommerceServerExtensionsLogic.jar, where drive:/path is the temporary directory that will hold the exported code. For example, C:/ExportTemp/WebSphereCommerceServerExtensionsLogic.jar

    8. Click Finish.

  8. To export the OrderStatusTableDisplay.jsp file:

    1. In the Enterprise Explorer view, navigate to...

      Stores | WebContent | Consumer_Direct_name | Snippets | Order | Cart

      ...where Consumer_Direct_name is the name of the consumer direct sample store.

    2. From the OrderStatusTableDisplay.jsp file's pop-up menu, select Export.

    3. In the Export window, select General > File System and click Next.

    4. In the To directory field, enter the temporary directory that will hold the exported code, for example, C:/ExportTemp.

    5. Click Finish.

  9. Transfer files to target machine

    In this step, we will create a temporary directory on the target WebSphere Commerce Server and then copy the files into this directory. In subsequent steps, we will place the different types of code into the appropriate place within the WebSphere Commerce application.

    To copy the files from the development machine to the target WebSphere Commerce Server:

    1. On the target WebSphere Commerce Server, create a temporary directory called drive:\ImportTemp.

    2. Determine how we will copy the files from one computer to another. You can do this by mapping a drive on the target WebSphere Commerce Server to the development machine, or by using an FTP application.

    3. From the development machine, copy the contents of drive:\ExportTemp into drive:\ImportTemp on the target WebSphere Commerce Server.

  10. Stop the target WebSphere Commerce application

    Open the WAS administration console and stop the WebSphere Commerce application:

    1. Open the WAS administrative console by entering the following URL in a Web browser: http:// host:9060/ibm/console , where host is the name of the target machine.

    2. Click Applications > Application Types > WebSphere Enterprise Applications to see a list of installed applications.

    3. Select the WebSphere Commerce application, for example WC_demo, and click Stop.

  11. Export a backup copy the EAR

    Export a backup copy of the EAR, so that you can revert to the old version in the future if desired:

    1. To see a list of installed applications...

      Applications | Application Types | WebSphere Enterprise Applications

    2. Select the WebSphere Commerce application, for example WC_demo, and click Export.

    3. Follow the wizard and save the EAR file in a backup directory. If the EAR file is large in size, this action might take some time.

  12. Update store assets on the target WebSphere Commerce Server

    Update the store with the modified OrderStatusTableDisplay.jsp file using the WAS administrative console:

    1. In the WAS administrative console, click...

      Applications | Application Types | WebSphere Enterprise Applications

    2. Select the application name, for example WC_demo, and click Update.

    3. Select Replace or add a single file.

    4. In the In the Specify the path beginning with the installed application archive file to the file to be replaced or added field, enter the relative path to the file from the WebSphere Commerce EAR directory on the target machine. For example...

      Stores.war/Consumer_Direct_name/Snippets/Order/Cart/OrderStatusTableDisplay.jsp

      ...where Consumer_Direct_name is the name of the consumer direct sample store.

    5. In the Specify the path to the file section, specify the path to the OrderStatusTableDisplay.jsp file. For example...

      drive:\ImportTemp\OrderStatusTableDisplay.jsp

      If you are running the WAS Administrative Console on the target machine, select...

      Local file system

      ...since the files are local to the browser. If you are running the WAS Administrative Console on a different machine, select Remove file system, since the files are remote to the browser.

    6. Click Next.

    7. Click OK.

    8. Once the update completes, select Manage Applications to continue making the changes before restarting the server. Leave the WAS administrative console open.

  13. Update the WebSphereCommerceServerExtensionsLogic.jar file on the target WebSphere Commerce Server

    In this section we will update the target WebSphere Commerce Server to use the new command and data bean JAR file,...

    1. In the WAS administrative console, select the application name, for example WC_demo, and click Update.

    2. Select Replace or add a single file.

    3. In the Specify the path beginning with the installed application archive file to the file to be replaced or added field, enter the relative path to the file from the WebSphere Commerce EAR directory on the target machine. In this case, enter WebSphereCommerceServerExtensionsLogic.jar because the file is directly under the EAR directory.

    4. In the Full file section, specify the path to the WebSphereCommerceServerExtensionsLogic.jar file. For example...

      drive:\ImportTemp\WebSphereCommerceServerExtensionsLogic.jar

      If you are running the WAS Administrative Console on the target machine, select Local file system, since the files are local to the browser. If you are running the WAS Administrative Console on a different machine, select Remove file system, since the files are remote to the browser.

    5. Click Next.

    6. Click OK.

    7. Once the update completes, select Manage Applications to continue making the changes before restarting the server. Leave the WAS administrative console open.

    It is possible to update both the store assets and the WebSphereCommerceServerExtensionsLogic.jar in one partial application update. In this tutorial the updates are separated for clarity. However in a production environment it is likely more efficient to combine the two updates into one update.

    Tip: If you see a class cast exception, you likely chose the wrong type of update, for example, you choose Single Module instead of Single File.

  14. Update the Order-OrderCaptureData.jar

    1. In the WAS administrative console, select the application name, for example WC_demo, and click Update.

    2. Select Replace or add a single module.

    3. In the Specify the path beginning with the installed application archive file to the file to be replaced or added field, enter Order-OrderCaptureData.jar.

    4. If you are running the WAS Administrative Console on the target machine, select Local file system, since the files are local to the browser. If you are running the WAS Administrative Console on a different machine, select Remove file system, since the files are remote to the browser.

      Specify the Full path to the Order-OrderCaptureData.jar file.

    5. Click Next.

    6. If the target machine is using Derby, select FastPath and click Next. You can then skip the remaining steps in 14f and continue to 14g.

      If the target machine is not using Derby, in the Preparing for the application installation screen:

      1. Select Override existing bindings.

      2. In the EJB 1.1 CMP bindings section, select Default bindings for EJB 1.1 CMPs.

      3. In the JNDI name field, enter the datasource JNDI name of the target WebSphere Commerce Server. For example:

        • jdbc/WebSphere Commerce DB2 DataSource myInstance where the target WebSphere Commerce Server is using a DB2 database, and the WCS instance name is myInstance

        • jdbc/WebSphere Commerce Oracle DataSource myInstance where the target WebSphere Commerce Server is using an Oracle database, and the WCS instance name is myInstance.

        • jdbc/WebSphere Commerce iSeries DataSource myInstance where the target WebSphere Commerce Server is using an iSeries database, and the WCS instance name is myInstance.

      4. In the username field, enter the user name of the database user.

      5. In the password and verify password fields, enter the password of the database user.

      Your screen should be similar to the following:

    7. Leave all other default values and click Next.

    8. On the Application Security Warnings screen, click Continue.

    9. On the Install New Application screen, click Step 10: Summary.

    10. A summary of changes displays. Click Finish.

    11. When the update completes successfully, click Save to Master Configuration.

    12. On the Enterprise Applications screen, click Save to save the changes to the master configuration. All the changes are saved, including updating the JSP page, command and data bean file, and the EJB jar file.

    13. Close the WAS administration console.

  15. Stop and start the WAS

    You must stop and start the WAS to pick up the changes you deployed.

    To stop and start the server:

    1. At a command prompt, navigate to...

      WC_PROFILE/bin

    2. Stop the WAS. For example, on the Windows operating system, enter stopServer server1. The server has stopped successfully when you see the message: Server server1 stop completed.

    3. Start the WAS. For example, on the Windows operating system, enter startServer server1. Wait until you see the message similar to: Server server1 open for e-business; process id is 3740.

    4. Navigate to...

      WC_PROFILE \logs\server1

    5. Examine the SystemOut.log file. Ensure the server started successfully without errors.

  16. Verify the code on the target WebSphere Commerce Server Place at least two orders then verify the code by following the instructions in Test the new finder.

< Previous


+

Search Tips   |   Advanced Search