Debugging

Debugging a Jini application is difficult because there are so many bits to it, and these bits are all running separately: the server for a service, the client, lookup services, possibly remote activation daemons, and HTTP servers. There are a few (not many) errors within the Jini objects themselves, but more important, many of these objects are implemented using multiple threads, and the flow of execution is not always clear. There are no magic debug flags that can be turned on to show what is happening.

On either the client or service side, a debugger such as jdb can be used to step through or trace execution of the client or the server. Having lots of print statements helps, too, and you can also turn on the following three flags:

java -Djava.security.debug=access \
     -Dnet.jini.discovery.debug=1 \
     -Djava.rmi.server.logCalls=true ...

These flags don't give complete information, but they do give some, and can at least tell you if the application parts are still living.

The logging API introduced in Jini 1.4 has been adopted by Jini 2.0. It can also be used for debugging and is discussed in chapter 20.