Why and when to perform this task
Java 2 security uses several policy files to determine the granted permission for each Java program. See Java 2 security policy files for the list of available policy files supported by WebSphere Application Server. The library.policy file is the template for shared libraries (Java library classes). Multiple enterprise applications can define and use shared libraries. Refer to Managing shared libraries for information on how to define and manage the shared libraries.If the default permissions for a shared library (union of the permissions defined in the java.policy file, the app.policy file and the library.policy file) are enough, no action is required. The default library policy is picked up automatically. If a specific change is required to share a library in the cell, update the library.policy file.
Syntax errors in the policy files cause the application server to fail. Edit these policy files carefully.
Steps for this task
wsadmin> set obj [$AdminConfig extract cells/cell_name/nodes/ node_name/library.policy c:/temp/test/library.policy]The previous two lines were split onto two lines for illustrative purposes only.
Result
An updated library.policy is applied to shared libraries after the servers restart.Example
java.policyapp.policylibrary.policylibrary.policygrant { };
If the shared library in a cell requires permissions that are not defined as defaults in the java.policy file, app.policy file and the library.policy file, update the library.policy file. The missing permission causes the exception, java.security.AccessControlException. The missing permission is listed in the exception data.
java.security.AccessControlException: access denied (java.io.FilePermission install_dir/lib/mail-impl.jar read)The previous lines are split into two lines for illustrative purposes only. The install_dir variable represents your installation directory.
When a Java program receives this exception and adding this permission is justified, add a permission to the library.policy file.
grant { permission java.io.FilePermission "install_dir/lib/mail-impl.jar", "read"; };The previous lines are split into two lines for illustrative purposes only. The install_dir variable represents your installation directory.
To decide whether to add a permission, refer to Access control exception.
What to do next
Restart the related Java processes for the changes in the library.policy file to become effective.Related concepts
Access control exception
Java 2 security policy files
Related tasks
Configuring the was.policy file
Configuring spi.policy files
Configuring library.policy files
Adding the was.policy file to applications
Configuring server.policy files
Configuring java.policy files
Using Policy Tool to edit policy files