This article covers a Bloomreach Experience Manager version 13. There's an updated version available that covers our most recent release.

Run 2 Local Bloomreach Experience Manager Instances Simultaneously

Introduction

Goal

Run two Cargo-based Bloomreach Experience Manager instances simultaneously in a development environment.

Background

If you install and run a default archetype that created a Bloomreach Experience Manager project, containing a site, CMS and repository, then by default the following ports are in use:

  • 8080: The Tomcat http connector port on which Tomcat listens for incoming connections to the site and the cms.

  • 8205: The TCP/IP port number on which Tomcat waits for a shutdown command.

  • 8009: The Tomcat https connector port on which Tomcat listens for incoming secure connections to the site and the cms.

  • 8000: The debug port. 

If you have enabled RMI, by default port 1099 is also in use.

If your are using Relevance in your project, by default ports 9200 and 9300 are also in use (by Elasticsearch).

If you want to run two Cargo Tomcat instances at the same time, you must specify alternative port numbers in one of the instances.

Configuration

In the second Bloomreach Experience Manager project, specify alternative port numbers in the cargo-maven2-plugin plugin's properties by editing the Cargo profile in the project's root pom.xml:

<plugin>
   <groupId>org.codehaus.cargo</groupId>
   <artifactId>cargo-maven2-plugin</artifactId>
   <configuration>
     <configuration>
       <properties>
         <cargo.servlet.port>9080</cargo.servlet.port>
         <cargo.tomcat.ajp.port>9009</cargo.tomcat.ajp.port>
         <cargo.rmi.port>9205</cargo.rmi.port>
         <cargo.jvmargs>
           <![CDATA[-agentlib:jdwp=transport=dt_socket,address=9000,server=y,suspend=n -noverify ${javaagent}]]>
         </cargo.jvmargs>
       </properties>
     etc.

Make sure that the <properties> tag is the only one at that level, some poms may already have a properties tag there!

If you are using Relevance in your project, also make the following changes (skip if not using Relevance):

  • In your project's root pom.xml, specify alternative port numbers for Elasticsearch in the cargo.run profile's properties:

        <profile>
          <id>cargo.run</id>
          <!-- SNIP -->
          <properties>
            <es.tcpPort>9500</es.tcpPort>
            <!-- SNIP -->
            <es.httpPort>9400</es.httpPort>
            <!-- SNIP -->
          </properties>
        </profile>
    
  • In conf/context.xml, change the port in the Elasticsearch data store configuration to the new value of the es.httpPort property:

    <Environment name="elasticsearch/targetingDS" value="{'indexName':'visits', 'locations':['http://localhost:9400/']}" type="java.lang.String"/>

Start the second instance with:

mvn -P cargo.run
Use a different hostname for each Tomcat instance, for example:
- Tomcat 1:  http://localhost:8080/cms
- Tomcat 2: http://127.0.0.1:9080/cms
Otherwise, the HTTP session will be shared and user sessions will conflict.

Although you will not immediately run into problems if you don't change the location on which the repository is bound for remote RMI connections some use cases require you to specify a separate location for one of the instances. For instance, if you plan to use the JCR runner. You can do this by changing the repository-address context parameter in web descriptor of the CMS or alternatively conf/context.xml.

For the Channel Manager to work with different ports than the default 8080, you need to also take care of the following:

  1. Enter the CMS Console and configure the port according to what you have defined in your pom.xml file, as discussed above. So you have to configure at /hst:myproject/hst:hosts/dev-localhost:

    - hst:defaultport = 9080
  2. Rename the node /hst:myproject/hst:hosts/dev-localhost/localhost to /hst:myproject/hst:hosts/dev-localhost/127.0.0.1.

  3. Rename the node /hst:platform/hst:hosts/dev-localhost/localhost to /hst:platform/hst:hosts/dev-localhost/127.0.0.1.

See View a document in a channel for more information.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?