Deprecated featureWebSphere Commerce Developer

Enabling store separation in a development environment

You can separate the store WAR from the WebSphere Commerce EAR within your development environment. Separating the store WAR within the development environment can help store developers test the deployment of store assets into the separated EAR files and any shared libraries.When the store separation process completes, a new store EAR is created that contains an copy of the store WAR. The original store WAR within the WebSphere Commerce EAR is disabled. With this separation, the storefront assets for your WebSphere Commerce instance are included either within the store EAR or the WebSphere Commerce EAR and referenced by the store EAR through a shared library.

Before you begin

Ensure that you complete the following tasks:
  • Configure your development environment to use a DB2 or Oracle database. For more information, see Overview: Changing the development database.

    You cannot use the default Apache Derby database for a separated store environment. In a separated store environment, the WebSphere Commerce and WebSphere Commerce search EAR files cannot share the custom class loader to load the shared libraries. To separate the store archive in a development environment, the WebSphere Commerce and WebSphere Commerce search EAR files must be deployed on separate WebSphere Application profiles. These two applications, however, must access the same database. The Derby database, however, supports only one connection so you must switch your development environment database.

  • Enable any features for store that your store needs. For example, store-enhancements.
  • Publish a starter store archive. For example, the following task uses the ExtendedSitesV2 starter store archive as an example.
  • Move the WebSphere Commerce search EAR to a new application server profile. To separate your WebSphere Commerce store web archive (WAR) from the WebSphere Commerce EAR in your development environment, you must first move the WebSphere Commerce search EAR to a different application server.
  • Populate and build the search index data.

Procedure

Create a stores module.
  1. Create an EAR enterprise application project.
    1. In WebSphere Commerce Developer, right-click within the Enterprise Explorer view. Select New > Enterprise Application Project.
    2. For the Project name, enter 'WC_Stores'. Click Next.
    3. Select the check box for Stores and click Finish to add the Stores web project to the generated EAR.

      New EAR Application Project window

  2. Update the context root for the Stores.war of the store EAR file.
    1. In the Enterprise Explorer view, go to the StoreEAR\META-INF directory. Open the application.xml file for editing.
    2. Update the value for the <context-root> element for the Stores.war to be /webapp/wcs/stores.
      For example,
      <web>
      <web-uri>Stores.war</web-uri>
      <context-root>/webapp/wcs/stores</context-root>
      </web>
    3. Save and close the file.
  3. Remove the Stores web project from the WebSphere Commerce EAR.
    1. Expand the WC project. right-click WebSphereCommerceServer. Select Open With > Application Deployment Descriptor Editor.
    2. In the Design tab, expand Web: Stores.war in the list of web projects and select Web. In the Details section, update the value for the Context root* so that the project is no longer your default store web project.
      For example, set the context root to be /oldstore.

      Application Deployment Descriptor Editor window

    3. Save your changes.
  4. Add the WC_Stores EAR to the WebSphere Commerce Test Server.
    1. Right-click the WebSphere Commerce Test Server. Select Add and Remove.
    2. Select WC_Stores and click Add to add the project to the WebSphere Commerce Test Server.

      Add and Remove window

    3. Right-click the WebSphere Commerce Test Server. Click Publish.
    4. Restart the WebSphere Commerce Test Server.
  5. Create a shared library, WC_demo, between the WebSphere Commerce EAR and the new Store EAR.
    1. In the Servers view, right-click the WebSphere Commerce Test Server. Select Administration > Run Adminstrative Console.
    2. Expand Environment. Click Shared libraries.
    3. Click New. Enter the details for the shared library.
      • For the library Name, enter WC_demo
      • For the library Classpath, enter all of the classpaths for the WebSphere Commerce EAR. For example, the StoreSeparationDeveloperClassPaths.txt text file includes the class paths for store assets that are provided with Feature Pack 7. The class paths in this file are prefixed with the convention workspace_dir/. Replace this prefix with the path to your workspace directory.
      • Do not select the check box for Use an isolated class loader for this shared library

      New Shared Library window
    4. Click Apply > Save directly to the master configuration
  6. Create a custom class loader that references the shared library.
    1. In the WebSphere Application Server administration console, expand Servers > Server Types. Click WebSphere application servers. Then, click your WebSphere Commerce Test Server.
    2. Click the Configuration tab. In the Server Infrastructure section, expand Java and Process Management. Click Class loader.

      Application server configuration window

    3. Click New.
    4. For the Class loader order, select Classes loaded with parent class loader first.
    5. Click Apply > Save directly to the master configuration. The new class loader displays in the list of class loaders for your server.
    6. Click the new class loader within the list of class loaders for your server. The configuration options for the class loader displays. In the Additional Properties section, click Shared library references.
    7. Click Add. For the Library name, select the shared library that you created.
    8. Click Apply > Save directly to the master configuration.
  7. In the Servers view, right-click the WebSphere Commerce Test Server. Click Publish.
  8. Create the feature enablement records for your separated store environment.
    1. In a file manager utility, go to the WCDE_installdir\properties\version directory.
    2. Create a new empty file within the version folder. Name the file store-separation.toolkit.70.component. You do not need to add any code within this file.
    3. Open a connection to insert data into your WebSphere Commerce development environment database.
    4. Run the following SQL statement to create a record in your database:
      insert into site(databasevendor, edition, version, release, mod, fixpack, compname) 
      values('IBM', 'ALL', 7, 0, 7, 0, 'store-separation');
  9. Restart the WebSphere Commerce Test Server.
  10. In a web browser, open your WebSphere Commerce store. Browse your store and complete a shopping flow. If your store displays and behaves correctly, your store archive separation is successfully complete for development environment.

What to do next

You can also separate the store WAR in your staging or production environment. For more information, see Separating the store WAR from the WebSphere Commerce EAR

For more information about deploying changes into your new separated store EAR, see Deploying new and changed store assets into a separated store EAR.