From OpenNMS
| This page is obsolete. Please see Jetty instead. Jetty has replaced Tomcat as the default servlet container for OpenNMS including situations where you run the web UI in a separate JVM. Using OpenNMS with Tomcat is no longer supported. |
Contents |
Using Tomcat 5.5 with OpenNMS
The use of Tomcat with OpenNMS is now optional, but it is still supported.
The following instructions cover how to use Tomcat 5.5 with OpenNMS through an RPM-based distro like CentOS or RHEL 5.
1. Install the opennms-webapp-standlone package. Feel free to remove the opennms-webapp-jetty package if installed.
yum install opennms-webapp-standalone rpm -e opennms-webapp-jetty
2. Using yum, install tomcat5
yum install tomcat5
3. Edit both /etc/tomcat5/tomcat5.conf and /etc/sysconfig/tomcat5:
Set JAVA_HOME to point to the same java that OpenNMS is using, and set the user to be "root"
JAVA_HOME="/usr/java/jdk1.6.0_11" TOMCAT_USER="root"
Note that it is possible to run as the tomcat user if care is taken to give that user write permission to /opt/opennms/etc and /opt/opennms/logs, but "root" will always work. Also, I have no idea why there are *two* config files but for some reason it seems the one in sysconfig overrides the one in tomcat5.
4. Run
$OPENNMS_HOME/bin/install -y -w $CATALINA_HOME/conf/Catalina/localhost
to copy the opennms.xml file to the proper location.
5. Edit opennms.properties and change all references to port "8980" to be "8080".
6. Comment out the Jetty section of /opt/opennms/etc/service-configuration.xml.
You can now use "/sbin/service tomcat5 start" to start Tomcat. Note you may see errors like this:
Starting tomcat5: /usr/bin/rebuild-jar-repository: error: Could not find jdbc-stdext Java extension for this JVM
/usr/bin/rebuild-jar-repository: error: Could not find jndi Java extension for this JVM
/usr/bin/rebuild-jar-repository: error: Some detected jars were not found for this jvm
/usr/bin/rebuild-jar-repository: error: Could not find xml-commons-apis Java extension for this JVM
/usr/bin/rebuild-jar-repository: error: Some detected jars were not found for this jvm
/usr/bin/rebuild-jar-repository: error: Could not find jaas Java extension for this JVM
/usr/bin/rebuild-jar-repository: error: Some detected jars were not found for this jvm
[ OK ]
that can safely be ignored.
Which versions of OpenNMS support Tomcat 5?
OpenNMS 1.2 does not work with Tomcat 5.5. With OpenNMS 1.2, you must use Tomcat 5.0 or Tomcat 4.1 (4.1.18 or newer, to be specific). Note that to use Tomcat 5 with OpenNMS 1.2, you must also follow the instructions in the section below entitled "How to use Tomcat 5 with OpenNMS 1.2". OpenNMS 1.3 requires Tomcat 5.5.
For OpenNMS 1.2 versions (stable) starting with 1.2.8, you'll want to run Tomcat 5.0. We are still using OpenNMSTomcatRealm for authentication, and it happens to use a deprecated logging function that only exists in 5.0, but not 5.5.
For the OpenNMS 1.3 branch (unstable), after around August 2006 or so, we suggest Tomcat 5.5. You should be able to use any relatively modern version of Tomcat that you want (and maybe even non-Tomcat servlet containers). We suggest using Tomcat 5.5, since that is what we tend to develop on, and the Tomcat community seems to prefer this over 5.0 (a lot less buggy seems to be the concensus that I see).
Tomcat 5 support was added to the 1.3 development branch on 2006-01-10 and to the 1.2 stable branch on 2006-02-21 (revisions 1.12 and 1.9.6.1, respectively, of src/web/src/org/opennms/web/authenticate/OpenNMSTomcatRealm.java). OpenNMS 1.2.8 supports Tomcat 5, as long as you make the tweaks below. As of 2006-06-15, there are no released versions of the unstable version of OpenNMS that have an authentication realm that supports Tomcat 5--if you want to use the unstable branch with Tomcat 5, you'll either have to compile OpenNMS from source to get the latest version of OpenNMSTomcatRealm.java, or disable the OpenNMS authentication realm within Tomcat (this is the "<Realm .../>" tag in the opennms.xml file mentioned below).
UPDATE: OpenNMS 1.2.8 supports Tomcat5. But the .spec file that went into creating the RPMs does not, so you have to use --nodeps to get the RPM installed. This will be corrected in 1.2.9 (see bug #1674).
How to use Tomcat 5 with OpenNMS 1.2
- This is only needed with OpenNMS 1.2 (stable), OpenNMS 1.3.1 (unstable), and unreleased versions from trunk in the source code repository through late July 2006. After that, including the OpenNMS 1.3.2 release, this step is not needed. Edit $OPENNMS_HOME/webapps/opennms.xml and comment-out the "<Logger ... />" tag. The file should now look something like this:
<Context path="/opennms" docBase="/opt/OpenNMS/webapps/opennms"
debug="0" reloadable="true">
<!-- <Logger className="org.opennms.web.log.Log4JLogger" homeDir="/opt/OpenNMS" /> --> <Realm className="org.opennms.web.authenticate.OpenNMSTomcatRealm" homeDir="/opt/OpenNMS" />
</Context>
- Execute the installer like normal, but with the argument to the "-w" option pointing at "$CATALINA_HOME/conf/[enginename]/[hostname]". For a default Tomcat 5 installation "[enginename]" will be "Catalina" and "[hostname]" will be "localhost". E.g.:
$OPENNMS_HOME/bin/install -y -w $CATALINA_HOME/conf/Catalina/localhost \
Note: if you changed the "<Engine>" tag in $CATALINA_HOME/conf/server.xml, the enginename and hostname parameters above will be different. The "[enginename]" (default: "Catalina") and "[hostname]" (default: "localhost") come from the "name" and "defaultHost" attributes of the <Engine> tag. E.g.:
<Engine name="Catalina" defaultHost="localhost">
You'll probably need to do this on Tomcat 5.5
[UPDATE: This is not required for the latest code in trunk]
Get a copy of xercesImpl.jar (you can find it in $OPENNMS_HOME/lib) and put it in $CATALINA_HOME/common/endorsed. Please edit the "discussion" page for this page and note whether or not you had to do this to get the webapp to work, and which version of Tomcat you are using. Thanks!
References
Thanks
Thanks go to Eric Molitor for his work on modifying OpenNMS' authentication realm to work with Tomcat 5 and publishing his notes on making OpenNMS work with Tomcat 5: TuxBot's Tomcat 5 Hack.






