Skip to main content

Configure the Java agent for Jetty

To configure the Java agent with a Jetty distribution:

  1. Download the Java agent JAR from one of these repositories:

  2. On your Jetty environment, replace <YourContrastJarPath> with the path to your Contrast JAR file. Then add the following line to your <JettyDirectory>/start.ini file:

    -javaagent:<YourContrastJarPath>
  3. If you are using Java 2 security manager, create a contrast.policy file that contains this code. (Replace <YourContrastJarPath> with the path to your Contrast JAR file.)

    grant codeBase "file:<YourContrastJarPath>" {
      permission java.security.AllPermission;
    };

    Then complete these configurations:

    • Jetty 7-8: Copy the file to the JETTY_HOME/lib/policy folder. Add --secure to the JETTY_ARGS environment variable.

    • Jetty 9: Add the policy you created to your own configured policy. Replace <YourPolicy> with the name of your policy and enable the security manager with the standard environment variable settings:

      -Djava.security.manager -Djava.security.policy=<YourPolicy>

      Important

      Jetty 9 and later do not officially support security management policies.

Tip

See the Jetty Policy for more information about using Jetty with Java 2 security manager.