Configure Lightrun with Apache Tomcat🔗
Apache Tomcat is an open-source Java application server that deploys applications using compressed Java web application resource (WAR) files.
To start using Lightrun, add an additional parameter to the JAVA_OPTS configuration variable in the catalina.sh file. This ensures the Lightrun agent runs every time the web server restarts.
-
Copy the following agent path configuration:
Replace the placeholders with the appropriate values:-agentpath:<install_dir>/agent/lightrun_agent.so=--lightrun_extra_class_path=<tomcat-path>/webapps/<app-name.war>-
install_dir: The path where the agent is saved.-
tomcat-path: The path to the Tomcat project.-
app-name.war: The name of the project's WAR file. -
Paste the Lightrun agent path as an additional parameter to the
JAVA_OPTSvariable in yourWARfile. For example, if the agent is extracted at/tmp/agentand Tomcat is located in theDownloadsfolder, use the following configuration:JAVA_OPTS="$JAVA_OPTS -agentpath:/tmp/agent/lightrun_agent.so=--alsologtostderr,--lightrun_extra_class_path=/home/someuser/Downloads/apache-tomcat/webapps/app.war" -
Restart the Tomcat server to apply the configuration.
./catalina.sh stop ./catalina.sh start -
An alternative way to launch it is by setting the
CATALINA_OPTSvariable before starting the server. For example:CATALINA_OPTS="-agentpath:<install_dir>/agent/lightrun_agent.so=--alsologtostderr,--lightrun_extra_class_path=<tomcat_path>/webapps/SampleApp-1.0-SNAPSHOT.war" <tomcat_path>/bin/startup.sh