Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Tomcat 7

Tomcat 7

This section explains how to deploy Elastic Path web applications on a Tomcat 7 production server.

Note: Before you begin

Make sure that:

  • A Java 8 JDK or JRE is installed.
  • Apache Tomcat 7.0 (see system requirements for specific versions) is installed.
  • Active MQ 5.11.1 or later installed and running
  • You have the Web Application .WAR files that were specifically built for Tomcat.
  • You have created a database for Elastic Path.
  • You have unzipped the assets archive to a known location.
  • You have synchronized the date and time of all application servers with the date and time of your database server.

Installing Java Advanced Imaging

If you are using Storefront, you must install Java Advanced Imaging into your production server's JDK as detailed below:

  1. Go to: http://download.java.net/media/jai/builds/release/1_1_3/
  2. Download and unzip jai-1_1_3-lib.zip
  3. Copy the contents of JAI_HOME\lib to your Java_HOME\jre\lib\ext directory.

Creating a .keystore file

In order to use SSL on your production server, you must create a .keystore file.

  1. Open the command prompt and input the following command to begin creating the .keystore file.
    keytool -genkey -alias ElasticPath -keyalg RSA
  2. Enter in a password, full name, organizational unit, organization, city, state, and country code when promoted.
  3. When prompted to enter a key password, press Return to generate the .keystore file in your home directory.

Configuring Tomcat

Configuring Startup Scripts

  1. In <Tomcat_HOME>\bin, open catalina.bat (catalina.sh for Linux) with a text editor.
  2. Modify JAVA_OPTS to include the following:
    -Xmx1024m -Dsun.lang.ClassLoader.allowArraySyntax=true

Configuring Connectors

  1. With an XML editor, open server.xml located in <Tomcat_HOME>\conf
  2. In server.xml, replace the HTTP Connector element as shown below:
    <Tomcat_HOME>\conf\server.xml
    Before After
    <Connector port="8080" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443" />
    
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000" redirectPort="8443"
               acceptCount="100" disableUploadTimeout="true"
               enableLookups="false" maxHttpHeaderSize="8192"
               maxSpareThreads="75" maxThreads="150"
               URIEncoding="UTF-8"/>
    
  3. In server.xml , replace the SSL Connector element as shown below:
    <Tomcat_HOME>\conf\server.xml
    Before After
    <!-- 
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
       maxThreads="150" scheme="https" secure="true"
       clientAuth="false" sslProtocol="TLS" />
    -->
    
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
    		SSLEnabled="true" secure="true" enableLookups="false"
    		disableUploadTimeout="true"
    		keystoreFile="HOME\.keystore"
    		keystorePass="PASSWORD"
    		acceptCount="100" maxThreads="25" scheme="https"
    		clientAuth="false" sslProtocol="TLS"
    		URIEncoding="UTF-8"/>
    

    where PASSWORD is the password you entered into the .keystore file and and HOME is your home directory.

Deploying Web Applications

Installing a JDBC Driver

  1. Download the JDBC Driver for your database:
    Note:
    Database JDBC Driver JAR file

    MySQL 5.6

    mysql-connector-java-5.1.37-bin.jar

    Oracle 12g

    ojdbc6-11.2.0.2.0.jar

  2. Place the JDBC Driver JAR file in <Tomcat_HOME>\lib

Installing a JMS Driver in Tomcat

  1. Download the JMS drivers for the Commerce Engine's Asynchronous Event Messaging service.
    JMS Driver JAR file Links

    activemq-all-5.11.1.jar

    http://activemq.apache.org/2015/02/18/apache-activemq-5111-released.html

    geronimo-j2ee-management_1.1_spec-1.0.1.jar

    http://mvnrepository.com/artifact/org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spec/1.0.1

    geronimo-jms_1.1_spec-1.1.1.jar

    http://mvnrepository.com/artifact/org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1
    slf4j-api-1.6.6.jar http://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.6.6
    commons-pool-1.6.jar http://commons.apache.org/proper/commons-pool/download_pool.cgi
    hawtbuf-1.9.jar http://central.maven.org/maven2/org/fusesource/hawtbuf/hawtbuf/1.9/
  2. Install the JMS Driver JAR files in <Tomcat_HOME>\lib

Creating Context Files

  1. In <Tomcat_HOME>\conf, create a directory named Catalina
  2. Create a subdirectory in Catalina named after your hostname. ie. localhost
  3. For each web application you want to deploy:
    1. In your hostname subdirectory, create an xml file named <CONTEXT_PATH>.xml:
      Web Application Context Path.xml Name

      Commerce Manager Server

      cmserver

      Search Server

      searchserver

      Storefront

      storefront

      Cortex cortex
      Cortex Studio studio
    2. In <CONTEXT_PATH>.xml, insert the following code:
      <?xml version='1.0' encoding='UTF-8'?>
      <Context useHttpOnly="false">
          <Resource auth="Container" name="mail/Session" type="javax.mail.Session"/>
          <Resource name="jdbc/epjndi"
              auth="Container"
              scope="Shareable"
              type="javax.sql.DataSource"
              maxActive="100"
              maxIdle="30"
              maxWait="10000"
              removeAbandoned="true"
              username="USER"
              password="PASSWORD"
              driverClassName="DRIVER"
              url="JDBC_URL"
              testOnBorrow="false"
              testWhileIdle="true"
              timeBetweenEvictionRunsMillis="300000"
              validationQuery="select 1"/>
          <Resource auth="Container"
              name="jms/JMSConnectionFactory"
              type="org.apache.activemq.pool.PooledConnectionFactory"
              description="JMS Connection Factory
              factory="org.apache.activemq.jndi.JNDIReferenceFactory"
              brokerURL="ACTIVE_MQ_URL" 
              maxConnections="25"
              maximumActiveSessionPerConnection="25"
              expiryTimeout="10000"/>
      </Context>
      Note:

      Tomcat 7's useHttpOnly XSS-prevention feature is disabled as a workaround for a bug around DWR's CSRF prevention measures.

    3. Replace USER and PASSWORD with the information of an account that can access your database.
    4. Replace DRIVER with the JDBC Driver that corresponds to your DBMS and JDBC_URL with your Database Connection URL
      Database JDBC Driver Database Connection URL

      MySQL 5.1

      com.mysql.jdbc.Driver

      jdbc:mysql://HOSTNAME:PORT/DBNAME?AutoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8

      For example:

      <Resource auth="Container" name="mail/Session" type="javax.mail.Session"/>
      	<Resource name="jdbc/epjndi"
      	    auth="Container"
      	    scope="Shareable"
      	    type="javax.sql.DataSource"
      	    maxActive="100"
      	    maxIdle="30"
      	    maxWait="10000"
      	    removeAbandoned="true"
      	    username="ep"
      	    password="ep"
      	    driverClassName="com.mysql.jdbc.Driver"
      	    url="jdbc:mysql://127.0.0.1:3306/COMMERCEDB?AutoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8"
      	    />
      where HOSTNAME, PORT, DBNAME, and SID correspond to your specific database.

Deploying .WAR files

  1. Place the Web Application .WAR files in <Tomcat_HOME>\webapps
  2. Rename the copied .WAR file with its context path. For example, if you created storefront.xml, you rename the storefront WAR file you're deploying to storefront.war.
Note:

When you start Tomcat 7, you may see the following error message in your console and logs:

SEVERE: Unable to process Jar entry [com/ibm/icu/impl/data/LocaleElements_zh_PINYIN.class] from Jar [jar:file:/c:/apache-tomcat-7.0.30/webapps/cmserver/WEB-INF/lib/icu4j-2.6.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60

This is a known issue with the icu4j-2.6.1.jar that can be ignored.