logo

Domino 8.5.1 Java Coding Annoyance

There's little doubt that 8.5.1 is a huge leap forward in terms of coding. Writing LotusScript is now almost (but not quite) a pleasure.

As pleased as I've been with the LotusScript editor I'm a bit dismayed at the new way of coding Java, which I used for the first time just recently.

If you open a Java agent now you'll see something like this:

image

To actually edit the Java you need to open the JavaAgent.java file by double-clicking it. You then get to the code, like below:

image

Notice that I've modified the code and that (to denote this) there's an asterix next to the source code file and the main Agent tab, as ringed above.

The image below is of the same thing but after I've saved/compiled the source code by pressing Ctrl+S. Notice the asterix is now only next to the Agent itself.

image

What I've learnt is that saving the source code does not save the Agent. I learnt this the hard way, which was:

  1. Change the code
  2. Press Ctrl+S
  3. Alt-Tab back to browser
  4. Press F5
  5. Scratch head as nothing's changed
  6. Goto 1

I can't remember how many times I repeated the above before I started putting System.out.println("here") in the code and before I finally realised my "mistake".

I'm sure there's a good reason why saving your code doesn't save the Agent but, unless you know it won't, it's one of those maddening experiences that just wastes a whole chunk of your day.

Here's hoping that the first reply to this is somebody telling me I need to alter the preferences to build the agent when the source changes. I've got a Java-heavy spell coming up and this is going to drive me nuts.

Comments

  1. Have you set autobuild on?

    In designer - toolbar: Project -> Build Automatically

      • avatar
      • Jake Howlett
      • Fri 20 Nov 2009 06:22 AM

      Yes.

  2. Ouch. Good thing I avoid Java like the plague (no offense to Java, just not my preference).

    That's as bad as modifying a subform by double-clicking it in a form instead of opening it directly. Makes you save the form you opened even if it wasn't otherwise modified.

      • avatar
      • Jake Howlett
      • Fri 20 Nov 2009 07:07 AM

      I'm a LotusScript man too for the most part. I just use Java when it's the best/only choice.

      In this current case I'm doing some e-commerce stuff and need to interface Domino with a 3rd party "payment gateway" daemon running on the server. To process a transaction the Java agent opens a socket on port 5000 to the other software and sends some XML to it. The Java then needs to process the returned XML. Java seems the obvious choice as soon as XML and sockets came in to it.

    1. Funny, for me it’s the opposite. To me, it makes more sense to use Java when coding agents, web-services et al. But I’m mainly doing web-development, and very seldom traditional notes stuff. Java feels like a more “complete” and more suitable toolbox for that purpose (web, xml and networking stuff).

      I like the “new” Java editor a lot (it’s a huge improvement!), but the double-save-trouble is very painful, and not at all intuitive. A big #fail imho.

  3. You could have several java files in your java agent. So why build the whole "project" every time you save one of the files. But that feature has caused me to scratch my head also a few times. At least it works differently than before... :)

    The bigger annoyance for me is that by default (and I don't know how to get them back) the exception line numbers are lost from stack trace when the code is saved with 8.5.1.

    One workaround is to save the code with 8.0 (or even 8.5 seems to work) client.

    Below is the example of the same exception saved with 8.5.1 and 8.0.2:

    8.5.1

    java.lang.NullPointerException

    at xx.xxx.xxx.utils.Search.getResultFieldValue(Unknown Source)

    at xx.xxx.xxx.utils.Search.createResultDoc(Unknown Source)

    at xx.xxx.xxx.utils.Search.NotesMain(Unknown Source)

    at lotus.domino.AgentBase.runNotes(Unknown Source)

    at lotus.domino.NotesThread.run(Unknown Source)

    8.0.2

    java.lang.NullPointerException

    at xx.xxx.xxx.utils.Search.getResultFieldValue(Search.java:163)

    at xx.xxx.xxx.utils.Search.createResultDoc(Search.java:115)

    at xx.xxx.xxx.utils.Search.NotesMain(Search.java:59)

    at lotus.domino.AgentBase.runNotes(Unknown Source)

    at lotus.domino.NotesThread.run(Unknown Source)

    So this seems to be a "feature" that has come with 8.5.1. Apparently the 8.5.1 client gives the java compiler an optimize parameter (-O or something) which causes the compiler to optimize the code and remove the stack trace line numbers. There is possibility to configure compiler options but I have not managed to figure out how to change the behavior back as it was before (or those compiler option configurations do not work). For me that is a big annoyance and makes debugging harder.

    Btw: Has anyone figured out how to share the 8.5.1 LotusScript code templates among team or different client installations. I imagine it could be possible that one developer does the code templates and then some config file(s) are copied from 8.5.1 installation directory to other developers. But I haven't yet figured out where the 8.5.1 saves those template definitions.

      • avatar
      • Jake Howlett
      • Fri 20 Nov 2009 08:54 AM

      "why build the whole 'project' every time you save one of the files"

      How likely is it that you're going to want to change more than one of the files that make up the project before saving the "project" itself? Unlikely, I'd think. 99% of the time you either only have one file in the first place (the agent code) or you just want to make a change to one of the files. In this case you really don't want to have to save to files every time you make one change. It's driving me crazy.

    1. There is a checkbox "Compile Java code with debugging information" on the properties pane of java agents and script libraries.

      Enabling this option will provide line numbers in the stack trace.

      Show the rest of this thread

  4. Agree, very annoying!

    My theory is that it's because the agent (the whole package) is mounted locally when opened initially, when you save the file, you only save the javafile file locally, but in order to propagate the changes back to the nsf you need to save the complete package… or similar… something slightly more intelligent would have been preferred…

  5. Y are you going for java agents instead of lotus notes :)..

    are java agents faster than lotusscript agents?

  6. Aye, the least they could do is offer a "Save All" button. :P

    • avatar
    • Tony Austin
    • Sat 21 Nov 2009 01:45 AM

    Thanks for the "heads up" about this. I'm just getting into Java for some iText work with PDFs generated from Notes docs, and still feel a bit uneasy about how some of suchlike thongs work in the Eclipse-based Domino Designer (not only for Java).

    As well as a few counter-intuitive things like the one you've mentioned, some things are a step or two further removed than they were on the old Designer. A trivial but still irritating example of the latter is that you have to click on a button to launch the Workspace Icon Editor, rather than simply double-clicking the item in the navigator in the left column.

    OFF-TOPIC:

    In a similar vein (about Designer 8.5.x annoyances), is that for years I've copied icon images from those shared databases of dozens or hundreds of Notes workspace icons, then pasted them directly into the icon editor matrix. But with the Eclipse-based IDE this doesn't seem to work any more, which is quite annoying.

    I've discovered a workaround: I paste the icon into the icon editor of Domino Designer 7.0.3 working under Windows 7 XP Mode (virtualised), and find that then I can copy the icon matrix from there across into the 8.5.x icon editor running natively under Windows 7.

    While I agree wholeheartedly with everybody else that the Designer for 8.5.1 is a huge advancement, I get the feeling at times that such rough edges have arisen from the dreaded "committee consensus" way of deciding things, rather than being signed off by daily practitioners [like us] who need everything to operate ultra-efficiently without superfluous steps. But then, I'm just an out-of-touch old grump approaching the end of forty years in the game, so who am I to criticise!

  7. Oops, I just wrote: "suchlike thongs work in the Eclipse-based Domino Designer" (meaning "things" of course) and I lash myself for slipping up.

    While I did use a spell-checker before hitting the submit button, unfortunately it accepted "thongs" -- which are those simple two-strap sandals that Americans (and maybe others?) call "flip-flops" ...

  8. Works as designed. Java agent are complete self contained projects (from a Java point of view). Unfortunately Eclipse doesn't have the notion of sub-projects (will be addressed in Eclipse 4), so whenever you edit a Java agent a temporary project is created. Only when you save that project the results are copied back into the NSF as agent. So the little annoyance is caused by a platform feature lack. Also the two step process (save Java, save project) allows to temp. save Java with errors without copying faulty code back into the NSF.

    One more little caveat:

    Domino 8.5 could run Java6, however the compatibility default for Java agents is set yo Java1.3. You need to get into the project properties of the agent to switch it in order to use Java5/6 language capabilities (I like generics, they make things clearer).

    :-) stw

  9. If we are onto Java programming, I have made the plunge with notes 8.5.1, but I am stumbling on the debugging mode - I have not been able to make this work correctly - the jvm in which the java agent gets debugged does not get found. I have set the port correctly in the java debugging preferences, made a remote java thingy as the debug configuration, set localhost as the machine, and I am still stumped.

    Also, the Java Debug console now does not want to display.

    Do you guys have any hints?

    Cheers,

    andrew

      • avatar
      • Santosh Kumar
      • Wed 25 Nov 2009 06:59 AM

      I understand that you restarted Notes after making the port changes and have checked to "Compile the Java code with debugging information".

      There is detailed help in "Debugging Java Code " section. It would be great if you could post the exact error message or step where its not working.

      Thank you.

      Santosh Kumar

    • avatar
    • Rishi
    • Tue 1 Dec 2009 07:17 PM

    Hey Jake,

    Instead of .java , Save your agent . Saving agent will complie and save .java file as well .

    Rishi

    • avatar
    • Craig M
    • Tue 15 Dec 2009 06:53 AM

    I'm trying to compile some java classes in Domino Designer

    8.5 that contain some generics, I get the following error

    message,

    "generics are not supported in source 1.3 use source 5 or

    higher to enable generics."

    I've tried editing the compiler preferences and setting them

    to 1.6 and I've tried setting the project specific compiler

    settings to 1.6 but still this problem persists.

    I'm not familiar with Domino so I'd greatly appreciate any

    advice that can be given, thanks.

    1. "Generics" are a type of constructor syntax in Java which doesn't seem to play well with however Domino implements Java compiling. Try compiling outside of Domino Designer and importing the Jar to use it. That should get you around the problem.

      You can read more about Generics here: http://java.sun.com/docs/books/tutorial/java/generics/gentypes.html

      It's basically a cryptic shorthand method for reducing the amount of code you have to write to get a bit more flexibility out of your compiled library.

      Show the rest of this thread

    • avatar
    • Johnny J
    • Mon 24 May 2010 05:07 AM

    I have a annoying problem too.

    I wrote a helloworld java class and put it in local folder, then included the folder

    in classpath. Buy I still couldn't run the class using run cinfigurations. It raised NoClassFound exception.

    I assumed that desinger would work the same way as eclipse in java perspective. But I think I'm wrong.

    Any help would be appreciated.

    Johnny

    • avatar
    • Anna
    • Mon 31 May 2010 09:42 AM

    Hi,

    I'm trying to debug an agent but when I start debugging I get this error: "Unable to install breakpoint in JavaAgent due to missing line number attributes. Modify the compiler options to generate the attributes of numbers line. "

    how can I change them?

    Bye Bye

  10. There's a new preference option in 8.5.2 to automatically save the agent if you save a Java file. It's called "Autosave java design element on save on individual Java sources".

    See also http://mattwhite.me/blog/2010/10/26/useful-new-preference-in-dde-852-for-java-agents.html

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Fri 20 Nov 2009

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content