Running Eclipse Amlen JMS client applications under the Java Security Manager

The Eclipse Amlen JMS client can run with the Java™ Security Manager enabled. To successfully run applications with the Security Manager enabled, you must configure your JVM with a suitable policy definition file.

The simplest way to configure your JVM is to change the policy file that is supplied with the JRE. On most systems, this file is stored in the path lib/security/java.policy, relative to your JRE directory. You can edit policy files by using your preferred editor or by using the policytool program that is supplied with your JRE.

The imaclientjms.jar file must be configured with the authority to complete the following tasks;
  • Create sockets
  • Read various properties from the environment
The following information provides an example of a policy file entry that allows the Eclipse Amlen JMS client to run successfully under the default security manager.
grant codeBase "file:IMACLIENT_INSTALLATION_PATH/ImaClient/jms/lib/imaclientjms.jar" {
  permission java.net.SocketPermission "IMASERVER:IMAPORT", "connect";
  permission java.util.PropertyPermission "IMATraceLevel", "read";
  permission java.util.PropertyPermission "IMATraceFile", "read";
  permission java.io.FilePermission "IMACLIENT_TRACE_FILE", "write";
};
Using the example that is provided, complete the following steps:
  • Replace the string IMACLIENT_INSTALLATION_PATH with the location where the Eclipse Amlen JMS client is installed on your system.
  • Replace the string IMASERVER with the host name for Eclipse Amlen server.
  • Replace IMAPORT with the port number you that you want to use for connections.
  • Replace IMACLIENT_TRACE_FILE with a file name if you want to specify a file for trace output. The value that you assign to IMACLIENT_TRACE_FILE must match the file name that you specify for IMATraceFile when you run a client application.

You can specify multiple entries for java.net.SocketPermission and for java.io.FilePermission. Specify one line for each host/port pair, or for each file name. You can optionally specify * for IMASERVER:IMAPORT and for IMACLIENT_TRACE_FILE. However, use * with caution as this value grants access to all possible values.

This example of a policy file entry enables the Eclipse Amlen JMS client to work correctly under the security manager. You might need to enable your own code to run correctly before your applications work. The sample code that is shipped with Eclipse Amlen JMS client is not specifically enabled for use with the security manager.