Bob Balaban's Blog

     
    alt

    Bob Balaban

     

    The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    Bob Balaban  July 31 2009 06:47:50 AM
    Greetings, Geeks!

    This topic just keeps coming back. You have a Java agent for Domino (or Notes). You want to debug it. There's no Java debugger in Designer (ok, let me clarify that: Designer 8.5x - also known as "DDE", Domino Designer in Eclipse - has a Java debugger. But (as of this writing) you can't use it as you'd expect, you have to use the "remote debugger", which I do not recommend).

    Eclipse (plain, vanilla Eclipse) has a nice Java debugger, but how do you debug an Agent when the agent program needs the Notes/Domino infrastructure? There IS an answer: use the pattern I created back in 2004 called "The 2-Headed Beast".

    The 2-headed beast is called that because it's a Java program with 2 "heads": One for debugging in Eclipse, one for running as a Java agent. Each "head" is a small piece of code which adapts the class to one environment or the other, then invokes the "business logic" of the program, so that the important code is common to both cases.

    You can debug the class in Eclipse, then just import the .java or .class file into Designer to configure as an agent. It works!

    As I said, I first developed this technique back in 2004, and presented it at a Lotus Advisor Devcon. I've done versions of the same presentation at DNUG, Lotusphere and The View Devcon, the latest such being back in 2007.

    Anyway, a PDF of the full presentation, and the associated Java code examples can be found elsewhere in this very blog:
    http://www.bobzblog.com/tuxedoguy.nsf/dx/here-are-the-files-from-my-view-presentation-java-agents-in-eclipse

    Enjoy!
    Geek ya later

    (Need expert application development architecture/coding help? Contact me at: bbalaban, gmail.com)
    Follow me on Twitter @LooseleafLLC
    This article ©Copyright 2009 by Looseleaf Software LLC, all rights reserved. You may link to this page, but may not copy without prior approval.