There're situations in which a JBoss Application Server administrator might be interested in finding out the origin of RMI calls. For example, an AS received a remote shutdown request, who fired it? Since Java 1.1, you can enable logging of RMI calls by adding to the AS java start options: -Djava.rmi.server.logCalls=true
This option instructs the JMV to log every RMI call made to the server, and which IP address it came from, to the stdout. For example, let's say a JBoss Application Server is running on 192.168.4.111 with -Djava.rmi.server.logCalls=true
And from 192.168.4.143, you call:
./bin/shutdown.sh -s jnp://192.168.4.111:1099
192.168.4.111's console output would show:
14-May-2007 17:32:03 sun.rmi.server.UnicastServerRef logCall FINER: RMI TCP Connection(1)-192.168.4.143: [192.168.4.143: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)] 14-May-2007 17:32:03 sun.rmi.server.UnicastServerRef logCall FINER: RMI TCP Connection(1)-192.168.4.143: [192.168.4.143: org.jnp.server.NamingServer[0]: public abstract java.lang.Object org.jnp.interfaces.Naming.lookup(javax.naming.Name) throws javax.naming.NamingException,java.rmi.RemoteException] 14-May-2007 17:32:03 sun.rmi.server.UnicastServerRef logCall FINER: RMI TCP Connection(1)-192.168.4.143: [192.168.4.143: org.jnp.server.NamingServer[0]: public abstract java.lang.Object org.jnp.interfaces.Naming.lookup(javax.naming.Name) throws javax.naming.NamingException,java.rmi.RemoteException] 14-May-2007 17:32:04 sun.rmi.server.UnicastServerRef logCall FINER: RMI TCP Connection(2)-192.168.4.143: [192.168.4.143: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)] 14-May-2007 17:32:04 sun.rmi.server.UnicastServerRef logCall FINER: RMI TCP Connection(2)-192.168.4.143: [192.168.4.143: org.jboss.invocation.jrmp.server.JRMPInvoker[1]: public abstract java.lang.Object org.jboss.invocation.Invoker.invoke(org.jboss.invocation.Invocation) throws java.lang.Exception] 17:32:04,475 INFO [Server] LifeThread.run exits! 17:32:04,578 INFO [Server] Shutting down the JVM now! 17:32:04,578 INFO [Server] Runtime shutdown hook called, forceHalt: true 17:32:04,579 INFO [Server] JBoss SHUTDOWN: Undeploying all packages
Further information can be found in RMI logging and RMI properties
Note: Bear in mind that if you enable RMI call logging it will log all RMI calls, including all remote EJB invocations. This can lead to a big increase in the number of messages logged to the stdout depending on much an application relies on RMI calls (i.e remote EJB calls, HTTP via RMI calls,...etc).
Referenced by:
Comments