HTML5, CSS3, jQuery, JSON, Responsive Design...

Debugging Domino Java agents in Eclipse

Michael Brown   September 9 2010 04:59:24 AM
As Bob Balaban, who did the pioneering work on this subject, said, this one just keeps on coming back.  Well over ten years after the introduction of Java into Notes/Domino, the product sill has no built-in debugger.

The solution, it seems, is to use a debugging facilities of an external product, such as eclipse.  I've spend all day trying to get this to work, and the screenshot below is proof that yes, it can be done!

There's quite a few posts around the interweb that explain how to set it all up.  None of them are a definitive how-to, IMHO, so I may put together one of my own.  I worked it out by pinching bit and bobs from various of those posts, and I am, in particular, indebted to the aforementioned Mr Balaban.  (Google for him or search Planet Lotus.)

I've got it stepping though the code line by line, in and out of (my own) classes, and displaying the status and values for various variables at any stage.

My main disappointment, so far, is that the debugger doesn't really show much in they way of properties for the built-in Domino objects.  For example, check again the screen shot above; the currentDB object is of Domino Java's Database class (which is, of course, the equivalent of LotusScript's NotesDatabase class).  And yet, it has only a small number of properties that show in the debugger's Variables tab, and they don't look much like Domino properties either.  I mean, what exactly is a "weakObject", I wonder?

I don't know if this because of step that I missed or maybe that's just all you can expect from an external debugger.  Answers welcome!  I'll add it to the up coming how-to post.

1Bob Balfe  09/09/2010 9:37:23 AM  Debugging Domino Java agents in Eclipse

A weak object in Java is essentially a pointer. You can enhance the Eclipse debugger to show more properties if you know what the underpinnings for the object are. This may be difficult because I believe in the case of Domino/Lotus objects the pointers are to handles in C.

2axel  09/09/2010 10:53:52 AM  Debugging Domino Java agents in Eclipse

Remember that the java.domino.Database object is just a tiny wrapper around some C-stuff. Eclipse can't show those properties, I guess.

But there are many getter and setter methods on the java.domino objects for stuff thats in properties of the LotusScript objects.

In Eclipse you can call methods of objects, when the program flow is stoped at a break point.

In case you really need to know those properties...

3Mike Brown  09/09/2010 4:28:55 PM  Debugging Domino Java agents in Eclipse

Thanks for the info guys, and the tip about running code when the program is paused, Axel.

Doing that helped me see another underlying problem here: as far as Java is concerned, the Domino object properties aren't properties at all; they're methods. So, there's really nothing to see unless you actually trigger the method and assign the result to somewhere.

That becomes clear when you do try to run some code on the fly in the Display window (it's Window->Show View->Display when you're in the Debug perspective.) When you do start typing some Domino-related code there, you get a type-ahead drop down showing you all of the related Domino methods, which is nice!