Configure the Java agent for GlassFish

To configure the Java agent for GlassFish:

2. Add Contrast's JVM parameter to the domain.xml file in your domain directory, \$<GLASSFISH_DIR>/domains/domain1.

3. Replace <YourContrastJarPath> with the path to your Contrast JAR and add this line within your profile's "java-config" element:

<jvm-options>-javaagent:<YourContrastJarPath></jvm-options>

To configure the agent with a YAML file in a location other than the default (/etc/contrast/java/contrast_security.yaml on a Linux machine), specify the YAML file path within the JVM parameter.

<jvm-options>-javaagent:<YourContrastJarPath> -Dcontrast.config.path=<YourContrastYAMLPath></jvm-options>

If you are using Java 2 security with GlassFish:

1. Append the Contrast permissions to the domains server policy.

For example, the domain1 server policy in <GLASSFISH_DIR>/domains/domain1/config/server.policy to enable the security manager with the Contrast agent.

2. Ensure the security manager is enabled by setting the java.security.manager system property with the asadmin tool using asadmin create-jvm-options -Djava.security.manager.

Tip

For more information see documentation on changing permissions for an application and enabling and disabling the Security Manager.