Bob Balaban's Blog

     
    alt

    Bob Balaban

     

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

    Bob Balaban  July 31 2009 05: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.
    Comments

    1Csabee  11/12/2009 3:01:36 AM  The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    Hey Bob,

    I'm sorry, but this is not new. I could debug Java agents using Eclipse in Lotus Notes 6.5 (I've started with LN 6.5). And with the built in Java debugger. So I don't see your point, why this article has any meaning.

    Anyway, if you need a correct documentation about it (6 pages only), mail me, and I will send it to you.

    2hoyt  11/13/2009 7:48:22 AM  The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    Hey Bob,I'm from China ,I saw your article by google.Now I have a problem,I write a java agent to get the data from Oracle,when I ran it on event i could get the right,but on schedule I couldn't get what I want.so I want to debug the agent,but i don't know how to do.please help me,think you.

    3Bob Balaban  11/13/2009 10:02:25 AM  The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    Suggest you follow the techniques outlined in the article to run your agent as a standalone program in Eclipse, then you can debug it.

    Domino Designer (still!) does not have a usable java debugger in it.

    Try adding your Oracle jdbc jar file to the server ....\jvm\lib\ext directory

    4hoyt  11/13/2009 6:43:23 PM  The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    I'm engaged in domino for just a moment,I had added the jar to the directory before,but java debug console printed the driver can not find.so I put it to agent project.I don't know how to use the techniques outlined.

    5Mark Demicoli  12/9/2009 9:17:43 PM  The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    I recently spent a couple of weeks trying to build a Java agent which utilizes the Google Calendar API for Java.

    Nearly pulled (the last few) strands of hair I have left. LS2J was a disaster also. Sorry! just having a sad geek rant. :)

    So I've decided to write it all in eclipse and deploy it either as a servlet or a simple java app running in a dos window. Pretty sad huh

    6Bob Balaban  12/9/2009 9:22:01 PM  The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    Good luck! Of course you have to use the tools that work, and avoid the ones that don't. (the trick is to know which is which, i guess....)

    If you figure out how to translate Google ICAL events into Notes calendar documents, let me know, this is a hard problem, especially when it comes to repeating meetings.

    7Tim Curtin  7/22/2010 12:42:04 PM  The 2-Headed Beast: Debugging Domino Java agents with Eclipse

    I've been able to use the java debugger by connecting remotely for a java applet contained on a form. I was hoping to do convert the applet to agent code, and was assuming I could continue to use the remote debugger. I notice in this post you say you don't recommend that. Would you mind explaining why? It seems to work out ok, and in my case the agent would be running locally in response to user input in my application. (I'm guessing I may just not know enough to recognize the possible issues with the idea.)