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.
- Create sockets
- Read various properties from the environment
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";
};
- 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 toIMACLIENT_TRACE_FILE
must match the file name that you specify forIMATraceFile
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.