1rmid(1) Remote Method Invocation (RMI) Tools rmid(1)
2
3
4
6 rmid - Starts the activation system daemon that enables objects to be
7 registered and activated in a Java Virtual Machine (JVM).
8
10 rmid [options]
11
12
13 options
14 The command-line options. See Options.
15
17 The rmid command starts the activation system daemon. The activation
18 system daemon must be started before activatable objects can be either
19 registered with the activation system or activated in a JVM. For
20 details on how to write programs that use activatable objects, the
21 Using Activation tutorial at
22 http://docs.oracle.com/javase/8/docs/technotes/guides/rmi/activation/overview.html
23
24 Start the daemon by executing the rmid command and specifying a
25 security policy file, as follows:
26
27 rmid -J-Djava.security.policy=rmid.policy
28
29 When you run Oracle’s implementation of the rmid command, by default
30 you must specify a security policy file so that the rmid command can
31 verify whether or not the information in each ActivationGroupDesc is
32 allowed to be used to start a JVM for an activation group.
33 Specifically, the command and options specified by the
34 CommandEnvironment and any properties passed to an ActivationGroupDesc
35 constructor must now be explicitly allowed in the security policy file
36 for the rmid command. The value of the sun.rmi.activation.execPolicy
37 property dictates the policy that the rmid command uses to determine
38 whether or not the information in an ActivationGroupDesc can be used to
39 start a JVM for an activation group. For more information see the
40 description of the -J-Dsun.rmi.activation.execPolicy=policy option.
41
42 Executing the rmid command starts the Activator and an internal
43 registry on the default port1098 and binds an ActivationSystem to the
44 name java.rmi.activation.ActivationSystem in this internal registry.
45
46 To specify an alternate port for the registry, you must specify the
47 -port option when you execute the rmid command. For example, the
48 following command starts the activation system daemon and a registry on
49 the registry's default port, 1099.
50
51 rmid -J-Djava.security.policy=rmid.policy -port 1099
52
53
55 An alternative to starting rmid from the command line is to configure
56 inetd (Oracle Solaris) or xinetd (Linux) to start rmid on demand.
57
58 When RMID starts, it attempts to obtain an inherited channel (inherited
59 from inetd/xinetd) by calling the System.inheritedChannel method. If
60 the inherited channel is null or not an instance of
61 java.nio.channels.ServerSocketChannel, then RMID assumes that it was
62 not started by inetd/xinetd, and it starts as previously described.
63
64 If the inherited channel is a ServerSocketChannel instance, then RMID
65 uses the java.net.ServerSocket obtained from the ServerSocketChannel as
66 the server socket that accepts requests for the remote objects it
67 exports: The registry in which the java.rmi.activation.ActivationSystem
68 is bound and the java.rmi.activation.Activator remote object. In this
69 mode, RMID behaves the same as when it is started from the command
70 line, except in the following cases:
71
72 · Output printed to System.err is redirected to a file. This file is
73 located in the directory specified by the java.io.tmpdir system
74 property (typically /var/tmp or /tmp) with the prefix rmid-err and
75 the suffix tmp.
76
77 · The -port option is not allowed. If this option is specified, then
78 RMID exits with an error message.
79
80 · The -log option is required. If this option is not specified, then
81 RMID exits with an error message
82
83 See the man pages for inetd (Oracle Solaris) or xinetd (Linux) for
84 details on how to configure services to be started on demand.
85
87 -Coption
88 Specifies an option that is passed as a command-line argument to
89 each child process (activation group) of the rmid command when
90 that process is created. For example, you could pass a property
91 to each virtual machine spawned by the activation system daemon:
92
93 rmid -C-Dsome.property=value
94
95
96
97 This ability to pass command-line arguments to child processes
98 can be useful for debugging. For example, the following command
99 enables server-call logging in all child JVMs.
100
101 rmid -C-Djava.rmi.server.logCalls=true
102
103
104
105 -Joption
106 Specifies an option that is passed to the Java interpreter
107 running RMID. For example, to specify that the rmid command use
108 a policy file named rmid.policy, the -J option can be used to
109 define the java.security.policy property on the rmid command
110 line, for example:
111
112 rmid -J-Djava.security.policy-rmid.policy
113
114
115
116 -J-Dsun.rmi.activation.execPolicy=policy
117 Specifies the policy that RMID employs to check commands and
118 command-line options used to start the JVM in which an
119 activation group runs. Please note that this option exists only
120 in Oracle's implementation of the Java RMI activation daemon. If
121 this property is not specified on the command line, then the
122 result is the same as though -J-
123 Dsun.rmi.activation.execPolicy=default were specified. The
124 possible values of policy can be default, policyClassName, or
125 none.
126
127 · default
128
129 The default or unspecified value execPolicy allows the rmid
130 command to execute commands with specific command-line options
131 only when the rmid command was granted permission to execute
132 those commands and options in the security policy file that
133 the rmid command uses. Only the default activation group
134 implementation can be used with the default execution policy.
135
136 The rmid command starts a JVM for an activation group with the
137 information in the group's registered activation group
138 descriptor, an ActivationGroupDesc. The group descriptor
139 specifies an optional ActivationGroupDesc.CommandEnvironment
140 that includes the command to execute to start the activation
141 group and any command-line options to be added to the command
142 line. By default, the rmid command uses the java command found
143 in java.home. The group descriptor also contains properties
144 overrides that are added to the command line as options
145 defined as: -D<property>=<value>.The
146 com.sun.rmi.rmid.ExecPermission permission grants the rmid
147 command permission to execute a command that is specified in
148 the group descriptor's CommandEnvironment to start an
149 activation group. The com.sun.rmi.rmid.ExecOptionPermission
150 permission enables the rmid command to use command-line
151 options, specified as properties overrides in the group
152 descriptor or as options in the CommandEnvironment when
153 starting the activation group.When granting the rmid command
154 permission to execute various commands and options, the
155 permissions ExecPermission and ExecOptionPermission must be
156 granted to all code sources.
157
158 ExecPermission
159
160 The ExecPermission class represents permission for the rmid
161 command to execute a specific command to start an activation
162 group.
163
164 Syntax: The name of an ExecPermission is the path name of a
165 command to grant the rmid command permission to execute. A
166 path name that ends in a slash (/) and an asterisk (*)
167 indicates that all of the files contained in that directory
168 where slash is the file-separator character,
169 File.separatorChar. A path name that ends in a slash (/) and a
170 minus sign (-) indicates all files and subdirectories
171 contained in that directory (recursively). A path name that
172 consists of the special token <<ALL FILES>> matches any file.
173
174 A path name that consists of an asterisk (*) indicates all the
175 files in the current directory. A path name that consists of a
176 minus sign (-) indicates all the files in the current
177 directory and (recursively) all files and subdirectories
178 contained in the current directory.
179
180 ExecOptionPermission
181
182 The ExecOptionPermission class represents permission for the
183 rmid command to use a specific command-line option when
184 starting an activation group. The name of an
185 ExecOptionPermission is the value of a command-line option.
186
187 Syntax: Options support a limited wild card scheme. An
188 asterisk signifies a wild card match, and it can appear as the
189 option name itself (matches any option), or an asterisk (*)
190 can appear at the end of the option name only when the
191 asterisk (*) follows a dot (.) or an equals sign (=).
192
193 For example: * or -Dmydir.* or -Da.b.c=* is valid, but *mydir
194 or -Da*b or ab* is not.
195
196 Policy file for rmid
197
198 When you grant the rmid command permission to execute various
199 commands and options, the permissions ExecPermission and
200 ExecOptionPermission must be granted to all code sources
201 (universally). It is safe to grant these permissions
202 universally because only the rmid command checks these
203 permissions.
204
205 An example policy file that grants various execute permissions
206 to the rmid command is:
207
208 grant {
209 permission com.sun.rmi.rmid.ExecPermission
210 "/files/apps/java/jdk1.7.0/solaris/bin/java";
211 permission com.sun.rmi.rmid.ExecPermission
212 "/files/apps/rmidcmds/*";
213 permission com.sun.rmi.rmid.ExecOptionPermission
214 "-Djava.security.policy=/files/policies/group.policy";
215 permission com.sun.rmi.rmid.ExecOptionPermission
216 "-Djava.security.debug=*";
217 permission com.sun.rmi.rmid.ExecOptionPermission
218 "-Dsun.rmi.*";
219 };
220
221
222
223 The first permission granted allows the rmid tcommand o
224 execute the 1.7.0 release of the java command, specified by
225 its explicit path name. By default, the version of the java
226 command found in java.home is used (the same one that the rmid
227 command uses), and does not need to be specified in the policy
228 file. The second permission allows the rmid command to execute
229 any command in the directory /files/apps/rmidcmds.
230
231 The third permission granted, an ExecOptionPermission, allows
232 the rmid command to start an activation group that defines the
233 security policy file to be /files/policies/group.policy. The
234 next permission allows the java.security.debug property to be
235 used by an activation group. The last permission allows any
236 property in the sun.rmi property name hierarchy to be used by
237 activation groups.
238
239 To start the rmid command with a policy file, the
240 java.security.policy property needs to be specified on the
241 rmid command line, for example:
242
243 rmid -J-Djava.security.policy=rmid.policy.
244
245 · <policyClassName>
246
247 If the default behavior is not flexible enough, then an
248 administrator can provide, when starting the rmid command, the
249 name of a class whose checkExecCommand method is executed to
250 check commands to be executed by the rmid command.
251
252 The policyClassName specifies a public class with a public,
253 no-argument constructor and an implementation of the following
254 checkExecCommand method:
255
256 public void checkExecCommand(ActivationGroupDesc desc, String[] command)
257 throws SecurityException;
258
259
260
261 Before starting an activation group, the rmid command calls
262 the policy's checkExecCommand method and passes to it the
263 activation group descriptor and an array that contains the
264 complete command to start the activation group. If the
265 checkExecCommand throws a SecurityException, then the rmid
266 command does not start the activation group and an
267 ActivationException is thrown to the caller attempting to
268 activate the object.
269
270 · none
271
272 If the sun.rmi.activation.execPolicy property value is none,
273 then the rmid command does not perform any validation of
274 commands to start activation groups.
275
276
277 -log dir
278 Specifies the name of the directory the activation system daemon
279 uses to write its database and associated information. The log
280 directory defaults to creating a log, in the directory in which
281 the rmid command was executed.
282
283 -port port
284 Specifies the port the registry uses. The activation system
285 daemon binds the ActivationSystem, with the name
286 java.rmi.activation.ActivationSystem, in this registry. The
287 ActivationSystem on the local machine can be obtained using the
288 following Naming.lookup method call:
289
290 import java.rmi.*;
291 import java.rmi.activation.*;
292 ActivationSystem system; system = (ActivationSystem)
293 Naming.lookup("//:port/java.rmi.activation.ActivationSystem");
294
295
296
297 -stop
298 Stops the current invocation of the rmid command for a port
299 specified by the -port option. If no port is specified, then
300 this option stops the rmid invocation running on port 1098.
301
303 CLASSPATH
304 Used to provide the system a path to user-defined classes.
305 Directories are separated by colons, for example:
306 .:/usr/local/java/classes.
307
309 · java(1)
310
311 · Setting the Class Path
312
313
314
315JDK 8 21 November 2013 rmid(1)