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.

4. Creating a Tomcat Server for the Commerce Engine

4. Creating a Tomcat Server for the Commerce Engine

The following instructions describe how to create a Tomcat Server in Eclipse for the extension Commerce Engine web applications, which are:

  • ext-cmserver-webapp
  • ext-search-webapp
  • ext-storefront-webapp
  • activemq-broker
Note: Before You Begin

Make sure you have the wtp-developer profile activated in your Maven settings.xml file. If wtp-developer is not active, activate the wtp-developer profile and rebuild your project by running mvn clean install in your Elastic Path root directory. You must do the rebuild in order to apply changes made to settings.xml.

Creating a Tomcat Server in Eclipse for the Commerce Engine Web Apps

  1. In Eclipse, choose File -> New -> Other.
  2. In the list of wizards, select Server -> Server and click Next.
  3. In the server type list, expand Apache, select Tomcat 7.0 and click Next.
  4. Click Browse and locate the your root Tomcat directory.
  5. In the JRE drop-down list, select jdk1.7.0_21 and click Next.
  6. Select ext-cmserver-webapp, ext-search-webapp, and ext-storefront-webapp, activemq-broker and click Add.
    Note:

    Ensure there is only one of each webapp present. For example, if you select the extension storefront, make sure you don't select ep-storefront from the list.

  7. Click Finish.

Configuring the Tomcat Server

  1. In Eclipse, choose Window -> Show View -> Other.
  2. Select Server -> Servers and click OK.
  3. Click the Servers tab.
  4. In the Servers tab, double-click the server you just created to display the server's Overview tab.
  5. Expand Timeouts, set Start to 300.
  6. Under Server Locations, make sure Use workspace metadata is selected

    tomcat7jpg.jpg

  7. Under General Information, click Open launch configuration.
  8. Click the Arguments tab and add the following arguments to the end of the VM arguments.
-Xmx1024m -XX:MaxPermSize=512m -Dsun.lang.ClassLoader.allowArraySyntax=true -XX:CompileCommand=exclude,org/apache/velocity/runtime/directive/Foreach,render

Configure the Tomcat's context.xml

  1. In Eclipse's package explorer, open Servers\<Your Server Name>\context.xml

    tomcat7-2jpg.png

  2. In context.xml, insert the following code before the </Context> tag:
    <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"
        />
    
     <Resource auth="Container" name="jms/JMSConnectionFactory" 
    		type="org.apache.activemq.ActiveMQConnectionFactory"
     		description="JMS Connection Factory"
     		factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
     		brokerURL="tcp://127.0.0.1:61616"/>
  3. Replace USER and PASSWORD with the account 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"
    	    />
  5. In the Servers tab, right click your server, select Clean... and click OK.
  6. In the Servers tab, right click your server and select Publish.