Jetty
  • 08 Sep 2023
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Jetty

  • Dark
    Light
  • PDF

Article summary

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

  1. Application Deployment Folder
    1. Log in to the Virtual Machine where Jetty is installed
    2. Utilize the below path as Application Deployment Folder
      %JETTY_HOME%\webapps
    3. Example:D:\jetty-Server-9.4.42\webapps
  2. Startup Script File Path- Jetty is executed as a jar
    1. Create a startup-script file in the %JETTY_HOME% directory
    2. Provide the required command in the newly created file
    3. Example: Create a file start_jetty.bat with the below command:
      java -jar D:\jetty-Server-9.4.42\start.jar
    4. 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:

  1. Shut down Jetty Server if it is running  
  2. Navigate to the directory of the Jetty Startup Script
    Example: D:\jetty-Server-9.4.42
  3. 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.jar
    NOTE
    • 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


Linux

Auto Instrumentation

  1. Application Deployment Folder
    1. Log in to the Virtual Machine where Jetty is installed
    2. Utilize the below path as Application Deployment Folder
      $JETTY_HOME/webapps
    3. Example: /opt/jetty-Server-9.4.42/webapps
  2. Startup Script File Path- Jetty is executed as a jar
    1. Create a startup-script file in the $JETTY_HOME directory
    2. Provide the required command in the newly created file
    3. Example: Create a file start_jetty.sh with the below command:
      java -jar /opt/jetty-Server-9.4.42/start.jar
    4. 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:

  1. Shut down Jetty Server if it is running
  2. Navigate to the $JETTY_HOME directory
    Example: /opt/jetty-Server-9.4.42
  3. 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.jar
    NOTE
    • 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
  4. Shut down the Jetty Server (if it is running)
  5. Navigate to the bin directory using the command:
    cd $JETTY_HOME/bin
  6. Take a backup of the file jetty.sh
  7. Modify the file jetty.sh to append VSP JVM argument to Java Options as described below
    1. Before Modification:
      JAVA_OPTIONS=(${JAVA_OPTIONS[*]}"-Djetty.home=$JETTY_HOME" "-Djetty.base=$JETTY_BASE" "-Djava.io.tmpdir=$TMPDIR")\
    2. 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")
  8. Start Jetty Server using the command:
    ./jetty.sh start


Was this article helpful?

What's Next