Skip to main content

Configure the Java agent for WebLogic

First, download the Java agent JAR from one of these repositories:

Use the guidelines below to configure the Java agent depending on how you run Contrast with WebLogic.

Unix

  1. If you launch WebLogic yourself, you must add Contrast's JVM parameter to the startWebLogic file in your installation's bin directory. For UNIX-based operating systems, the path to this file looks like:

    /path/to/appserver/userprojects/domains/base_domain/bin/startWebLogic.sh
  2. In this file, add the Contrast engine as a -javaagent to the JAVA_OPTIONS environment variable before the Java execution step. Replace <YourContrastJarPath> with the path to your Contrast JAR file. For example:

    export JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:<YourContrastJarPath>"

Windows

  1. For Windows systems, the path looks like:

    C:\Oracle\Middleware\userprojects\domains\base_domain\bin\startWebLogic.bat
  2. At the beginning of the file, add the Contrast engine as a -javaagent to the JAVA_OPTIONS environment variable. Replace <YourContrastJarPath> with the path to your Contrast JAR file. Substitute the WebLogic server for your environment. For example:

    set "JAVA_OPTIONS=%JAVA_OPTIONS% -javaagent:<YourContrastJarPath>"

Use Java 2 with WebLogic

  1. Create a contrast.policy file that contains this code (or append it to the catalina.policy file). Replace <YourContrastJarPath> with the path to your Contrast JAR file. For example:

    grant codeBase "file:<YourContrastJarPath>" {
      permission java.security.AllPermission;
    };
  2. WebLogic includes a template file under @WL_HOME/server/lib/weblogic.policy which contains the suggested starting point for booting a WebLogic server with the security manager enabled. Older versions of WebLogic (10 and prior) will require @WL_HOME in the template file replaced with the actual path to the root directory of the WebLogic install.

  3. When the security manager is enabled, the policy @WL_HOME/server/lib/weblogic.policy file acts as the default. Otherwise, a custom policy file may be specified with -Djava.security.policy==<YourPath> where <YourPath> is the path to your custom file. The == is important as it overrides the default path setting that WebLogic boots with.

    Tip

    For more information read about using Java Security to protect WebLogic resources.