Download and install the Java agent from Contrast before proceeding with the Configuration instructions.
If you launch GlassFish yourself, you must add Contrast's JVM parameter to the domain.xml file in your domain directory, ${GLASSFISH_DIR}\domains\domain1.
<!-- Within the your profile's "java-config" element, add the following lines: -->
<jvm-options>-javaagent:${DOWNLOADS}\contrast.jar</jvm-options>
Of course, you need to substitute the path to contrast.jar and the GlassFish server for your environment.
The following instructions walk you through the process to add the Contrast Java agent to an application using the IntelliJ IDE running GlassFish.
- In the menu bar, click the Start/Run icon next to the GlassFish service.
- Wait for the server to finish launching.
- Navigate to the GlassFish Server Administration Console (usually http://localhost:4848/).
- After the console has finished loading, select Configurations > server-config.
- Select JVM Settings.
- Select the tab for Profiler.
- Add the name "Contrast".
- Add the following JVM options:
-javaagent:${DOWNLOADS}/contrast.jar
- Select Save.
- Click on the Start/Run icon next to the GlassFish service from the top menu bar and select Restart Server.
A Contrast startup message should appear in the GlassFish server log console. (Allow one to two extra minutes for server startup.)
After GlassFish has finished the startup process, IntelliJ will open a new web browser.
- Navigate to your application, and allow an extra minute for it to start up.
The following instructions walk you through the process to add the Contrast Java agent to an application using NetBeans running GlassFish.
- Select the Services tab.
- Under Servers, right click on the GlassFish Server and select Start.
- Wait for the server to finish launching.
- Navigate to the GlassFish Server Administration Console (usually http://localhost:4848/).
- After the console has finished loading, select Configurations > server-config.
- Select JVM Settings.
- Select the tab for JVM Options.
- Add the following JVM options:
-javaagent:${DOWNLOADS}/contrast.jar
- Select Save.
- In NetBeans, right click on the GlassFish Server and select Stop.
- After the server has finished shutting down, right click on the project and select Run.
A Contrast startup message should appear in the GlassFish server log console. (Allow one to two extra minutes for server startup.)
After GlassFish has finished the startup process, NetBeans will switch to the HTTP Server Monitor mode and open a new web browser.
- Navigate to your application, and allow an extra minute for it to start up.