Install the Java microagent

  1. Review Java microagent compatibility to confirm that the Sqreen Microagent for Java is compatible with your Java application.
  2. Sign up to create your Sqreen account.
  3. Fetch your organization token. From the Sqreen Dashboard, access Account Settings > Environments & Tokens. Your token begins with env_org_. Take note of the token.
  4. Download the microagent.
    curl https://download.sqreen.com/java/sqreen.jar -o sqreen.jar
    
  5. To the JVM startup command, add the path to the microagent and your Sqreen token and application name. If your app uses more than one agent, be sure to require the Sqreen Microagent for Java last in the JVM arguments.
    -javaagent:/path/to/sqreen.jar
    -Dsqreen.token=<your Sqreen token>
    -Dsqreen.app_name=<your application name>
    
  6. Start the application.

Install in multiple environments

Typically, you install the Sqreen microagent in your production environment, but you can install it in multiple environments. Use a unique name describing the application and different token for each environment such as production, staging, and development.

  1. From the Sqreen Dashboard, navigate to Account Settings > Environments & Tokens to fetch a token associated to an existing environment or add a new one.
  2. When creating a new environment, Sqreen automatically creates a new token and associates it with it. Take note of the new token.
  3. Set up your application name and SQREEN_TOKEN in the Sqreen microagent configuration file.
-javaagent:/path/to/sqreen.jar
-Dsqreen.token=env_org_xxxxx
-Dsqreen.app_name='My Awesome App'

Install behind a proxy

If your host requires a proxy to connect to Sqreen, use the following install procedure.

  1. Review Java microagent compatibility to confirm that the Sqreen Microagent for Java is compatible with your Java application.
  2. Sign up to create your Sqreen account.
  3. Fetch your organization token. From the Sqreen Dashboard, access Account Settings > Environments & Tokens. Your token begins with env_org_. Take note of the token.
  4. Check the connectivity. Replace proxy and port with your proxy hostname and port.
    curl -I --proxy proxy:port https://back.sqreen.io/
    
  5. Review the output. Refer to example below.
    HTTP/2 404
    date: Tue, 04 Sep 2018 15:19:08 GMT
    content-type: application/json
    content-length: 37
    server: nginx
    
  6. Download the microagent
    curl --proxy proxy:port https://download.sqreen.io/java/sqreen.jar -o sqreen.jar
    
  7. To the JVM startup command, add the path to the microagent and your proxy configuration. (Alternatively, you can store these configurations in a configuration file.)
    -javaagent:/path/to/sqreen.jar
    -Dsqreen.token=<your Sqreen token>
    -Dsqreen.app_name=<your application name>
    -Dsqreen.proxy=http://proxy:3128/
    
  8. Start the application.

Uninstall

To uninstall Java microagent, remove the -javaagent parameter from the JVM command.

Install on a web application server

  1. Review Java microagent compatibility to confirm that the Sqreen Microagent for Java is compatible with your Java application.
  2. Sign up to create your Sqreen account.
  3. Fetch your organization token. From the Sqreen Dashboard, access Account Settings > Environments & Tokens. Your token begins with env_org_. Take note of the token.
  4. Download the microagent.
    curl https://download.sqreen.com/java/sqreen.jar -o sqreen.jar
    
  5. Set the JAVA_OPTS environment variable in your web app server and make sure it resolves each time the Java server restarts. (Alternatively, you can use the administration console provided with your web application server. Refer to your server's documentation to see how to properly change JVM settings.)
    export JAVA_OPTS="${JAVA_OPTS} -javaagent:/path/to/sqreen.jar"
    export JAVA_OPTS="${JAVA_OPTS} -Dsqreen.token=<your Sqreen token>"
    
  6. Start the application.

Uninstall from a web app server

To uninstall the Java microagent, remove the JAVA_OPTS export from your web app server.