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

GlassFish

  • Dark
    Light
  • PDF

Article summary

About this Article
This article provides VSP application instrumentation steps for GlassFish application server and provides steps to determine the values of deployment folder and start-up script path required during application configuration on CMS.


Variables %Glassfish_Home% and $Glassfish_Home used throughout this article refer to the root directory where the GlassFish Application Server is installed in Windows and Linux operating systems respectively. Some sample values are provided below:

  • %Glassfish_Home% - D:\glassfish-5.0-server\glassfish5\
  • $Glassfish_Home - /opt/glassfish-5.0-server/glassfish5


Windows

Auto Instrumentation

Supported Windows Version: The configuration described in this section is tested on Windows 2016 Operating System. To configure Glassfish Server with VSP for auto-Instrumentation, follow the steps below:

  1. Application Deployment Folder
    1. Log in to the Virtual Machine where GlassFish is installed
    2. Utilize the path below as Application Deployment Folder
      %Glassfish_Home%\domains\domain1\applications
    3. Example: D:\glassfish-5.0-server\glassfish5\domains\domain1\applications
  2. Startup Script File Path
    1. Provide the path below as Startup Script File Path
      %Glassfish_Home%\bin\asadmin.bat
    2. Example: D:\glassfish-5.0-server\bin\asadmin.bat


Manual Instrumentation

Navigate to the directory %Glassfish_Home%\bin where the startup script is located. Example: D:\glassfish-5.0-server\glassfish5\bin

Follow either Method 1 or Method 2 described below:

Method 1:

  1. Stop the GlassFish server if it is already running
    asadmin.bat stop-domain
  2. Take a backup of the file asadmin.bat
  3. Append the content below to the file asadmin.bat and save it. Ensure that <AppCollectiveID> mentioned below is replaced with the App Collective ID in the CMS Application Configuration section
    @echo off
    ECHO.%JAVA_TOOL_OPTIONS%| FIND /I "instrumentation.jar">Nul || (
       set JAVA_TOOL_OPTIONS=%JAVA_TOOL_OPTIONS% -javaagent:"%VSP_HOME_WEB_MEM%"\iae-java\instrumentation.jar -Dvirsec_appcontextpath=<AppCollectiveID>
    )
    
  4. Start the GlassFish server
    asadmin.bat start-domain

Method 2:

  1. Start the GlassFish admin server using the command:
    asadmin.bat start-domain
  2. Access the Glassfish admin-console URL: http://<Server-IP>:4848/
  3. Stop the Glassfish Standalone instance 
  4. Add each VSP argument (in separate lines) under “ADD JVM Option” for the GlassFish instance. Ensure that <AppCollectiveID> mentioned below is replaced with the App Collective ID in the CMS Application Configuration section
    -javaagent:c:\PROGRA~2\Virsec\virsec-web-mem\iae-java\instrumentation.jar
    -Dvirsec_appcontextpath=<AppCollectiveID>
    
  5. Start the GlassFish server Standalone instance 


Linux

Auto Instrumentation

Supported Linux Version: The configuration described in this section is tested on RHEL7 Operating System. To configure Glassfish Server with VSP for auto-Instrumentation, follow the steps below:

  1. Application Deployment Folder
    1. Log in to the Virtual Machine where GlassFish is installed
    2. Use the path below as Application Deployment Folder
      $Glassfish_Home/domains/domain1/applications
    3. Example: /opt/glassfish-5.0-server/glassfish5/domains/domain1/applications
  2. Startup Script File Path
    1. Provide the path below as Startup Script File Path
      $Glassfish_Home/bin/asadmin
    2. Example:/opt/glassfish-5.0-server/bin/asadmin


Manual Instrumentation

Navigate to the directory $Glassfish_Home/bin where the startup script is located. Example: /opt/glassfish-5.0-server/glassfish5/bin

Follow either Method 1 or Method 2 described below:

Method 1:

  1. Stop the GlassFish server if it is already running
    asadmin stop-domain
  2. Take a backup of the file asadmin
  3. Append the content below to the file asadmin and save it. Ensure that <AppCollectiveID> mentioned below is replaced with the App Collective ID in the CMS Application Configuration section
    export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -javaagent:/opt/virsec-web-mem/iae-java/instrumentation.jar -DVSP_HOME_WEB_MEM=/opt/virsec-web-mem -Dvirsec_appcontextpath="
  4. Start the GlassFish server
    asadmin start-domain

Method 2:

  1. Start the GlassFish admin server using the command:
    asadmin start-domain
  2. Access the Glassfish admin-console URL: http://<Server-IP>:4848/
  3. Stop the Glassfish Standalone instance 
  4. Add each VSP argument (in separate lines) under “ADD JVM Option” for the GlassFish instance. Ensure that <AppCollectiveID> mentioned below is replaced with the App Collective ID in the CMS Application Configuration section
    -javaagent:/opt/virsec-web-mem/iae-java/instrumentation.jar
    -Dvirsec_appcontextpath=<AppCollectiveID>
    
  5. Start the GlassFish server Standalone instance 



Was this article helpful?

What's Next