Configure the Java agent for JBoss EAP, JBoss AS or WildFly
Caution
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
Download the Java agent JAR from one of these repositories:
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/Linux:
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 domain.sh, 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"> <jvm-options> <option value="-javaagent:<YourContrastJarPath>"/> </jvm-options> </jvm> ... </server-group>
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:
Either pass a command-line argument
-secmgr
, or set an environment variableSECMGR
to true:SECMGR="true"
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>" { permission java.security.AllPermission; };
To allow the agent to function with Wildfly’s classloader system, modify the value of the environment variable
JBOSS_MODULES_SYSTEM_PKGS
(originallyorg.jboss.byteman
), to also include the Java agent base package:com.contrastsecurity.agent,org.jboss.byteman
Tip
Learn more about using Java EE 7 security manager with WildFly, or read the default policy implementation and policy file syntax.