Skip to main content

Configure the Java agent for JBoss EAP, JBoss AS or WildFly


Be careful not to confuse version numbers. JBoss EAP prior to version 7 is based on JBoss AS. JBoss EAP 7.X is based on WildFly.

Run JBoss with the Java agent

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

  2. You can either run JBoss from a BAT file, or in domain mode.

    • BAT file: If you run JBoss from domain.bat, standalone.bat, or run.bat with a .conf file, modify the configuration file. It should enable the Contrast JVM parameters and return to the start-up script.

      To do this, replace <YourContrastJarPath> with the path to your Contrast JAR file, and use the JBoss server directory for your environment. Then add this line to the end of your .conf file:

      • Windows:

        set "JAVA_OPTS=-javaagent:<YourContrastJarPath> %JAVA_OPTS%"
      • Unix:

        JAVA_OPTS="-javaagent:<YourContrastJarPath> $JAVA_OPTS"
    • Domain mode: If you run JBoss 6 EAP or JBoss AS 7.X in Domain mode using domain.bat or, you must add the -javaagent switch to the JVM options in $JBOSS_HOME/domain/configuration/domain.xml.

      In this example, replace <YourContrastJarPath> with the path to your Contrast JAR file:

      <server-group ...>
        <jvm name="default">
            <option value="-javaagent:<YourContrastJarPath>"/>

Use WildFly with Java 2 security manager

You can configure the Java agent when using WildFly with Java 2 security. WildFly versions 9 through 20 are supported. WildFly 8 is not supported.

To enable the Java 2 security manager in Wildfly:

  1. Either pass a command-line argument -secmgr, or set an environment variable SECMGR to true:

  2. To enable permissions for the Java agent, append this Contrast policy to $JAVA_HOME/jre/lib/security/java.policy (for JDK 6-8), or $JAVA_HOME/lib/security/default.policy (for JDK 9 and later). Replace <YourContrastJarPath> with the path to your Contrast JAR and use:

    grant codeBase "file:<YourContrastJarPath>" {
  3. To allow the agent to function with Wildfly’s classloader system, modify the value of the environment variable JBOSS_MODULES_SYSTEM_PKGS (originally org.jboss.byteman), to also include the Java agent base package: com.contrastsecurity.agent,org.jboss.byteman