---
title: Java 2 security installation for WebLogic, WebSphere and Solr v9
source: https://docs.newrelic.com/docs/apm/agents/java-agent/additional-installation/install-java-agent-java-2-security
---

If you're a WebLogic, WebSphere or Solr v9 user and use the Java 2 security model, our Java agent requires configuration in addition to the [Java agent installation](/install/java).

## WebLogic: Java 2 Security [#weblogic-java-2]

If you're using Java 2 security, add the following entry to `weblogic.policy` to complete installation:

```java
grant codeBase "file:YOUR_FULL_PATH_TO_FILE/newrelic/-" {
    permission java.security.AllPermission;
};
```

Specify the directory containing `newrelic.jar` in `/full/path/to/newrelic`. The default policy file location is `weblogic_root/server/lib/weblogic.policy`.

## WebSphere: Java 2 Security or Administrative Security [#websphere-java-2]

If you are using Java 2 Security or WebSphere Admin Security, you must grant all jars inside the New Relic install folder the proper permissions.

To enable New Relic for all app servers, edit the `java.policy` file:

1.  Open your `java.policy` file, located inside your WebSphere install directory at:

    ```
    YOUR_WEBSPHERE_INSTALL_DIRECTORY/java/jre/lib/security/java.policy
    ```
2.  Append the following text to your policy file, customizing the `file:` path to point to the folder containing `newrelic.jar`. Ensure you preserve the dash `-` at the end of the path, which grants all jars in the target folder the necessary permissions.

    ```java
    grant codeBase "file:/YOUR_FULL_PATH_TO_NEW_RELIC_FOLDER/-" {
        permission java.security.AllPermission;
        permission java.net.NetPermission "specifyStreamHandler";
        permission java.net.SocketPermission "*.newrelic.com", "connect,accept,resolve";
    };
    ```

    > #### ⚠️ IMPORTANT
    >
    > The `codeBase` value must use slashes, not backslashes, as the directory separator, even on Windows systems.
3.  Restart your application server.

> #### 💡 TIP
>
> For each app, Java security permissions are determined by the union of `java.policy` and `server.policy`. Do not put the same permission settings in multiple files.

For more on policy file syntax, see [Default policy implementation and policy file syntax](http://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html).

## Solr v9: Java 2 Security [#solr-java-2]

The security manager is enabled by default for Solr version 9.x when running under Java 24 or earlier. This will prevent the agent from operating properly.

Proper agent operation can be achieved via one of the following options:

1.  Set the `SOLR_SECURITY_MANAGER_ENABLED=false` environment variable or in the `solr.in.sh/solr.in.cmd` startup file.

2.  Append the following text to your policy file, Ensure you preserve the dash `-` at the end of the path, which grants all jars in the target folder the necessary permissions.

    ```java
    grant {
        permission java.io.FilePermission "/YOUR_FULL_PATH_TO_NEW_RELIC_FOLDER${/}-", "read";
        permission java.io.FilePermission "YOUR_FULL_PATH_TO_NEW_RELIC_FOLDER/-", "read";
        permission java.io.FilePermission "/proc/sys/kernel/random/boot_id", "read";
        permission java.io.FilePermission "/proc/self/mountinfo", "read";
        permission java.io.FilePermission "/proc/self/cgroup", "read";
        permission java.io.FilePermission "/proc/cpuinfo", "read";
    };
    ```

    > #### 💡 TIP
    >
    > If you're using Java 9+ and encountering access denied errors, you may need to grant additional permissions (such as `java.lang.RuntimePermission "accessSystemModules"`).

    > #### ⚠️ IMPORTANT
    >
    > The `codeBase` value must use slashes, not backslashes, as the directory separator, even on Windows systems.
