#Java
Posts tagged #Java · 10 posts
- The Java Fix for Domino IQ Timeouts: LLMReq.completionStream, and How XPages SSJS Calls It
Yesterday's piece used LotusScript's CompletionStream to get past Domino IQ's 5-minute timeout; if your code is Java (an agent, a bean) or XPages (SSJS), you hit the same timeout. This is the Java version: LLMReq.completionStream with the CompletionStreamCallback interface (return Continue/Stop to control the stream), plus a key fact — SSJS has no native LLM class, but SSJS's session IS a lotus.domino.Session, so you call the Java API directly or wrap the streaming in a Java class and reference it from SSJS. With a three-language comparison table.
2026.09.06 - Java's NotesException: .id, .text, and try/catch/finally
LotusScript error handling is On Error Goto, Err.Number, Resume. In Java, nearly every lotus.domino method throws a checked NotesException — the compiler forces you to handle it — and it carries .id (the Notes error code) and .text (the message). This piece covers Java exception handling: NotesException's fields, using .id against NotesError constants for targeted handling, and the rule that ties this whole Java data-layer series together — recycle belongs in finally, so it still runs when something throws.
2026.08.17 - Looping a DocumentCollection in Java: Get the Next One First, Then recycle This One
In LotusScript you loop a DocumentCollection with Set doc = coll.GetNextDocument(doc) and never think about memory. In Java the same loop over tens of thousands of documents exhausts the agent's memory — unless you recycle each one inside the loop, in an order you can't get wrong: fetch the next document using the current one, then recycle the current one. This piece covers the correct Java iteration idiom: DocumentCollection's getFirstDocument/getNextDocument, the isValid deletion-stub check, when to switch to the leaner ViewNavigator, and the recycle ordering LotusScript never makes you think about.
2026.08.16 - Why Can't You Just Use java.util.Date for Notes Dates in Java?
To work with a Notes date in Java you can't just use java.util.Date — there's a lotus.domino.DateTime in the way. It's a heavyweight back-end object with a handle behind it, so it leaks memory in a loop if you don't recycle it; it stores dates as strings and throws on bad input; and toJavaDate() is the bridge that converts it into Java's own date type so you can reach java.time. This piece covers how Java's DateTime is created, read, and written, how it crosses into Java's time world, and the recycle burden LotusScript doesn't carry over.
2026.08.15 - Reading and Writing Notes Items in Java: getItemValue Hands You a Vector, Not the Array You Know
In LotusScript, doc.GetItemValue returns a Variant array and you loop over it without a second thought. In Java, the same call returns a java.util.Vector — you have to know the element type, a missing item comes back empty instead of throwing, and if it holds DateTime objects it leaks memory. This piece covers reading and writing items on the Java Document: getItemValue and the typed getters and their missing-item behavior, what Java types replaceItemValue accepts and how it auto-creates an item, why appendItemValue quietly makes duplicate items, and three instincts LotusScript won't carry over.
2026.08.14 - Anatomy of a Java Agent: Triggers, Rights, Output, Debugging
The first three pieces assume the agent is already running — you can recycle, you have a Session, you run DQL. But how does a Java agent get triggered, whose rights does it run with, where does System.out go, and how do you debug it? This fills in the step before NotesMain(): the AgentBase skeleton, Trigger and unprocessedDocuments, the signer that decides an agent's rights, restricted vs unrestricted, and the System.out-to-log.nsf debugging path.
2026.08.10 - Running DQL from Java: DominoQuery and QueryResultsProcessor
The site's DQL trilogy teaches the query language, but it runs DQL from LotusScript or the console. In Java, DQL goes through two classes: DominoQuery compiles, tunes, and runs; QueryResultsProcessor sorts, aggregates, joins across databases, and outputs JSON. And a common first-time trip-up: you get both from the Database, not the Session. A field report on how DQL actually runs from Java.
2026.08.09 - Getting a Session in Java: NotesFactory, Local, and Remote
LotusScript's session is a global you never create; Java has no such thing. Before you touch a single document you have to obtain a Session yourself — and how you get one depends on whether your code runs as an agent, a standalone program, or remotely. A field report on NotesFactory's three paths, local (JNI) vs remote (DIIOP), the who-creates-recycles rule, and the two traps: JVM bitness and one session per thread.
2026.08.08 - Rewrote LotusScript in Java and Memory Blew Up? You Forgot recycle()
The same logic runs forever in LotusScript, then blows up the agent's memory the first time you loop it over tens of thousands of documents in Java. The reason is that every Java Domino object is backed by a native handle the garbage collector can't see. A field report on the mechanism, the four official rules, the loop leak pattern and its fix, NotesThread's role, and how local vs remote sessions change the cost.
2026.08.07 - NSF ODP Tooling: Build Domino NSFs from Source, No Designer Required
NSF ODP Tooling is an OpenNTF project that turns a binary NSF into a file-system On-Disk Project you can keep in Git, then compiles it back into a full NSF without Domino Designer — bringing real version control and CI/CD to Domino. Here's what it is, how the Maven plugin and container-based compilation work, and what the 4.1.0 release actually changed.
2026.06.27