REM on Apache Tomcat

By default REM runs on the Jetty web server bundled in the REM distribution package. The REM application is packaged as a standard war though, so running it on a different servlet container, like Apache Tomcat, is quite straightforward.

You will need:

  • the REM distribution package — rhino-element-manager-<version>.zip; expanded to a location of your choice.

  • an Apache Tomcat installation — either downloaded and configured manually, or installed via a package manager; minimum supported version is 7.0.39.

Setting up Tomcat to run REM

1

REM requires a few System Properties to be set in order to function properly.

In your Apache Tomcat installation, edit (or create) bin/setenv.sh and add the following lines:

REM_HOME="$CATALINA_BASE/rem_home"
CATALINA_OPTS="-Drem.home=$REM_HOME -Dderby.stream.error.file=$REM_HOME/derby.log -Drem.norestart=true"
CLASSPATH="$CATALINA_BASE/bin/rem-rmi.jar"

If you wish to have REM store its working files in a different location, you can change the REM_HOME value above.

2

The rem-rmi.jar is required to be on the System class path for REM Plugins to function correctly. You can find the jar in the root of the REM distribution package (rhino-element-manager-<version>/rem-rmi.jar). Copy it to $CATALINA_BASE/bin/rem-rmi.jar (to match the path specified in the CLASSPATH entry above).

3

Copy rem.war from rhino-element-manager-<version>/admin/resources/rem.war to $CATALINA_BASE/webapps/rem.war.

4

Edit $CATALINA_BASE/conf/server.xml and add a Context element to the Host element serving the REM application.

In this Context element, set initialisation parameters rem.config-file and rem.config-file.password similar to the example below:

<Context path="/rem">
        <Parameter name="rem.config-file" value="${rem.home}/rem.properties"/>
        <Parameter name="rem.config-file.password" value="You should choose a unique password &amp; it should be strong"/>
</Context>

You should now be able to start Apache Tomcat and access REM at <tomcat_base_url>/rem. If running Apache Tomcat locally using the default port 8080 then that would be http://localhost:8080/rem.

Customize REM logging

1

Unzip log4j2.properties from rem.war:

cd apache-tomcat-<version>
mkdir rem-tmp
cd rem-tmp
unzip ../webapps/rem.war WEB-INF/classes/log4j2.properties

2

Edit WEB-INF/classes/log4j2.properties, customizing the configuration as desired.

The default logging configuration is:

# log4j 2 configuration
status=error
name=PropertiesConfig

appender.rolling.type=RollingFile
appender.rolling.name=FILE
appender.rolling.fileName=${sys:catalina.base}/logs/rem.log
appender.rolling.filePattern = ${sys:catalina.base}/logs/rem.log.%i
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 10
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p <%t> [%c] %m{nolookups}%n

logger.rolling.name=rem
logger.rolling.level=INFO

rootLogger.level=INFO
rootLogger.appenderRef.file.ref=FILE

3

Replace WEB-INF/classes/log4j2.properties in rem.war:

zip ../webapps/rem.war WEB-INF/classes/log4j2.properties

4

Remove temporary files:

cd ..
rm -rf rem-tmp
Tip See the Log4j 2 documentation for more information on logging configuration.
Previous page Next page