About this Article
This article provides VSP application instrumentation steps for Jetty application server and provides the steps to determine the values of deployment folder and start-up script path required during application configuration on CMS.
Variables %JETTY_HOME% and $JETTY_HOME used throughout this article refer to the root directory where Jetty Application Server is installed in Windows and Linux operating systems respectively. Some sample values are provided below:
- %JETTY_HOME% - D:\jetty-Server-9.4.42\
- $JETTY_HOME - /opt/jetty-Server-9.4.42\
Windows
Auto Instrumentation
- Application Deployment Folder
- Log in to the Virtual Machine where Jetty is installed
- Utilize the below path as Application Deployment Folder
%JETTY_HOME%\webapps - Example:D:\jetty-Server-9.4.42\webapps
- Startup Script File Path- Jetty is executed as a jar
- Create a startup-script file in the %JETTY_HOME% directory
- Provide the required command in the newly created file
- Example: Create a file start_jetty.bat with the below command:
java -jar D:\jetty-Server-9.4.42\start.jar - Provide the path of this file as the Startup Script File Path in CMS
Example: D:\jetty-Server-9.4.42\start_jetty.bat
Manual Instrumentation
Supported Windows Version: The following configuration is tested on Windows 2016 Operating System. To manually configure the Jetty Server with VSP, follow the steps below:
- Shut down Jetty Server if it is running
- Navigate to the directory of the Jetty Startup Script
Example: D:\jetty-Server-9.4.42 - Start Jetty Severwith the below argument
-javaagent:c:\PROGRA~2\Virsec\virsec-web-mem\iae-java\instrumentation.jar -Dvirsec_appcontextpath=<AppCollectiveID> -jar D:\jetty-Server-9.4.42\start.jarNOTE- Set the value of JAVA_HOMEto user Profile or Command Line, to start Jetty Server in the command line.
- Example: SET "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161"
- Ensure that <AppCollectiveID> mentioned below is replaced with the App Collective ID in the CMS Application Configuration
- Set the value of JAVA_HOMEto user Profile or Command Line, to start Jetty Server in the command line.
Linux
Auto Instrumentation
- Application Deployment Folder
- Log in to the Virtual Machine where Jetty is installed
- Utilize the below path as Application Deployment Folder
$JETTY_HOME/webapps - Example: /opt/jetty-Server-9.4.42/webapps
- Startup Script File Path- Jetty is executed as a jar
- Create a startup-script file in the $JETTY_HOME directory
- Provide the required command in the newly created file
- Example: Create a file start_jetty.sh with the below command:
java -jar /opt/jetty-Server-9.4.42/start.jar - Provide the path of this file as the Startup Script File Path in CMS
Example: /opt/jetty-Server-9.4.42/start_jetty.sh
Manual Instrumentation
Supported Linux Version: The following configuration is tested on RHEL 7.5 Operating System. To manually configure the Jetty Server with VSP, follow the steps below:
- Shut down Jetty Server if it is running
- Navigate to the $JETTY_HOME directory
Example: /opt/jetty-Server-9.4.42 - Start Jetty Sever with below argument
java -javaagent:/opt/virsec-web-mem/iae-java/instrumentation.jar -Dvirsec_appcontextpath=<AppCollectiveID> -jar /opt/jetty-Server-9.4.42/start.jarNOTE- Set the value of JAVA_HOME and VSP_Home to user Profile or Command Line, to start Jetty Server in the command line.
- Example: export JAVA_HOME=/opt/jdk1.8.0_161
- Ensure that <AppCollectiveID> mentioned below is replaced with the App Collective ID in the CMS Application Configuration section
- Set the value of JAVA_HOME and VSP_Home to user Profile or Command Line, to start Jetty Server in the command line.
- Shut down the Jetty Server (if it is running)
- Navigate to the bin directory using the command:
cd $JETTY_HOME/bin - Take a backup of the file jetty.sh
- Modify the file jetty.sh to append VSP JVM argument to Java Options as described below
- Before Modification:
JAVA_OPTIONS=(${JAVA_OPTIONS[*]}"-Djetty.home=$JETTY_HOME" "-Djetty.base=$JETTY_BASE" "-Djava.io.tmpdir=$TMPDIR")\ - After Modification: Ensure that <AppCollectiveID>
mentioned above is replaced with the App Collective ID in the CMS Application Configuration section JAVA_OPTIONS=(${JAVA_OPTIONS[*]} -javaagent:/opt/virsec-web-mem/iae-java/instrumentation.jar -Dvirsec_appcontextpath=<AppCollectiveID> "-Djetty.home=$JETTY_HOME" "-Djetty.base=$JETTY_BASE" "-Djava.io.tmpdir=$TMPDIR")
- Before Modification:
- Start Jetty Server using the command:
./jetty.sh start