- 08 Sep 2023
- 2 Minutes to read
- Print
- DarkLight
- PDF
GlassFish
- Updated on 08 Sep 2023
- 2 Minutes to read
- Print
- DarkLight
- PDF
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:
- Application Deployment Folder
- Log in to the Virtual Machine where GlassFish is installed
- Utilize the path below as Application Deployment Folder
%Glassfish_Home%\domains\domain1\applications - Example: D:\glassfish-5.0-server\glassfish5\domains\domain1\applications
- Startup Script File Path
- Provide the path below as Startup Script File Path
%Glassfish_Home%\bin\asadmin.bat - Example: D:\glassfish-5.0-server\bin\asadmin.bat
- Provide the path below as Startup Script File Path
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:
- Stop the GlassFish server if it is already running
asadmin.bat stop-domain
- Take a backup of the file asadmin.bat
- 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> )
- Start the GlassFish server
asadmin.bat start-domain
Method 2:
- Start the GlassFish admin server using the command:
asadmin.bat start-domain
- Access the Glassfish admin-console URL: http://<Server-IP>:4848/
- Stop the Glassfish Standalone instance
- 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>
- 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:
- Application Deployment Folder
- Log in to the Virtual Machine where GlassFish is installed
- Use the path below as Application Deployment Folder
$Glassfish_Home/domains/domain1/applications - Example: /opt/glassfish-5.0-server/glassfish5/domains/domain1/applications
- Startup Script File Path
- Provide the path below as Startup Script File Path
$Glassfish_Home/bin/asadmin - Example:/opt/glassfish-5.0-server/bin/asadmin
- Provide the path below as Startup Script File Path
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:
- Stop the GlassFish server if it is already running
asadmin stop-domain
- Take a backup of the file asadmin
- 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="
- Start the GlassFish server
asadmin start-domain
Method 2:
- Start the GlassFish admin server using the command:
asadmin start-domain
- Access the Glassfish admin-console URL: http://<Server-IP>:4848/
- Stop the Glassfish Standalone instance
- 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>
- Start the GlassFish server Standalone instance