Richard Pajerski  Software development and consulting

Merry Christmas

by Richard Pajerski


Posted on Monday December 25, 2023 at 12:00AM in General


The time is accomplished, and the kingdom of God is at hand: repent, and believe the gospel.  (St. Mark 1:15; Douay-Rheims version).

Image (public domain): The Nativity with the Prophets Isaiah and Ezekiel, Duccio di Buoninsegna.  Courtesy National Gallery of Art, Washington.


Three easy-to-use Java 17 features in Notes/Domino 14

by Richard Pajerski


Posted on Tuesday December 19, 2023 at 03:14PM in Technology


As I mentioned previously, having Java 17 available with the latest release of Notes/Domino has brought welcome changes for Java developers.  Just to scratch the surface a bit, here are three language-level niceties that we can immediately benefit from:


1.  Simplified access to file contents
2.  Local-variable type inference (var identifier)
3.  Text blocks


1.  Simplified access to file contents
Java has been (in)famous for offering a number of ways to open/read and write/close files.  As of Java 11, perhaps the simplest way to get text out of a file is:

Files.readString(Path p);



A two-liner in a local Java agent on a Windows 11 client:


import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {

          Path p = Paths.get("C:\\Windows\\System32\\drivers\\etc\\hosts");
          System.out.println(Files.readString(p)); 
      } catch(Exception e) {
          e.printStackTrace();
      }
   }
}

Javadoc:  https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/file/Files.html#readString(java.nio.file.Path)


2.  Local-variable type inference (var identifier)

The var type identifier has been available since Java 10 and is intended to help reduce "boilerplate" code:

import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {

         var s = getSession();
         var db = s.getCurrentDatabase();
         System.out.println("Db title: " + db.getTitle());

                /* Contrast:
                     Session s = getSession();
                     Database db = s.getCurrentDatabase();
                   */

      } catch(Exception e) {
          e.printStackTrace();
      }
   }
}

More: Using the Var Type Identifier


3.  Text blocks
In Java 15, Text Blocks were introduced.  In a more developed application, it's probably a better idea to store strings and text outside of source code, especially if they need to be regularly modified.  But using text blocks can be a time saver for quick testing, demos, etc. and provide improved source readability.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {

         var textBlock = """

                Using text blocks in Java source

                code simplifies text formatting

                and improves readability!

                """;


         System.out.println(textBlock);


      } catch(Exception e) {
          e.printStackTrace();
      }
   }
}


Note: To use these features, remember to adjust your compiler levels appropriately:


New context-specific Notes 14 client preferences options -- nice touch!

by Richard Pajerski


Posted on Thursday December 07, 2023 at 01:13PM in Technology


Notes 14 is now GA and an improved listing of the Notes "Additional options" (File > Preferences > Basic Notes Client Configuration) is an unexpected but very welcome feature!

Previously, all options were in one long list and so the context where each one applied was not always clear.  Now a categorical description precedes each option entry:




Nice touch, HCL and thank you!


Domino/Notes 14 and Java in the client

by Richard Pajerski


Posted on Wednesday July 26, 2023 at 01:25PM in Technology


Those who have been programming with Java in Notes/Domino over the years will be pleased to learn of the move from Java 8.x to Java 17 which is planned for the next release of ND 14 at the end of the year.  The version gap is rather stark and indeed a lot has changed.  One nice summary of the changes between the two version can be found at The Java Almanac here:  https://javaalmanac.io/jdk/17/apidiff/8/.

I've yet to explore the impact to the ND world in any detail but will try to cover that in some future posts.  A particular area of interest for me that's still "unresolved" is how HCL intends to treat Java applets.  Here I mean applets embedded in Notes client applications, not for use in web browsers.  Applets were deprecated for removal in Java 17 and of course have long been out of use in web browsers.  But will HCL continue to support their use in the Notes client and if so, for how long?


Happy Easter

by Richard Pajerski


Posted on Sunday April 09, 2023 at 12:00AM in General


And suddenly there was a great trembling of the earth, because an angel of the Lord came to the place, descending from heaven, and rolled away the stone and sat over it; his face shone like lightning, and his garments were white as snow; so that the guards trembled for fear of him, and were like dead men.  (Saint Luke 28:2-4 Knox Version).

https://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/No%C3%ABl_Coypel_-_Resurrection_of_Christ_%28large_version%29.jpg/512px-No%C3%ABl_Coypel_-_Resurrection_of_Christ_%28large_version%29.jpg

Image (public domain): Resurrection of Christ by Noël Coypel


DOTS follow-up, SPR for applet bug

by Richard Pajerski


Posted on Wednesday February 15, 2023 at 10:27AM in Technology


Following up on my NSFDBHOOK post in December, I'm told the official word from HCL Product Management is that "HOOK and Event Management (EM) should be discontinued, as those have not been well used and tested functionality ..."  I can appreciate that it's hard to justify development if there isn't much traction, but having an easily accessible Java API for these low-level Domino events (without having to write my own DSAPI plugin) would've been a really handy feature for some of my custom applications.  There's always the Domino Ideas Portal for the future!

Regarding Java applets not loading in Notes, HCL is now tracking a fix under SPR #CECNCNPSCQ.

[February 28, 2023 update]  Defect article for applets can be found here:  https://support.hcltechsw.com/csm?id=kb_article&sysparm_article=KB0102913


Securing access to MongoDB with Sametime 12 Premium

by Richard Pajerski


Posted on Tuesday February 14, 2023 at 10:58PM in Technology


Setting up a new, fully functional stand-alone Sametime 12.0.1 Premium server on Docker instance is a relatively pleasant experience and HCL has made great strides is presenting a more simplified, compelling UX for the product than what was previously offered.  For example, the new interface for creating and customizing meetings gets all the important, relevant bits into a single page (a good introduction to the product can be found here).

But the thrust of this post is on securing the server itself, and more specifically the MongoDB portion where chat histories, contact lists and other details are stored.  HCL supports MongoDB versions 4.2 and higher on a best effort basis and I'm using version 6.0.4 on CentOS 8 for purposes of this post.  Here's what worked for me.

After installing, we configure our Sametime database using the MongoDB Shell; upon first connecting, there's no prompt for a password and we're plainly told:

"Access control is not enabled for the database. Read and write access to data and configuration is unrestricted"

Well, that's not good.  It was now possible to connect using mongosh and fully control the server *from anywhere, without a password*...  :-(

According to the installation guide, port 27017 should be "permitted bidirectionally".  That's understandable since a common strategy is to deploy the MongoDB server on its own host.  But even with this installation which has both the MongoDB server and Sametime on the same machine, closing off external access to 27017 caused internal connectivity problems for Sametime (I could no longer create meetings and chat histories were no longer available).

So next I turned to this document on securing MongoDB.  That method might work for other versions of MongoDB but it didn't work with 6.0.4 (the MongoDB server refused to start).  What I found is that "keyFile" authorization is needed for this version of MongoDB when replica sets are used (which is the default for Sametime).

Create the keyfile:

openssl rand -base64 812 > /opt/st12/mongosec.key

Be sure to also run these two commands on the keyfile or Mongo won't start:

chmod 400 /opt/st12/mongosec.key
chown mongod:mongod
/opt/st12/mongosec.key

Edit /etc/mongod.conf to tell MongoDB where the file is and enable authorization:

security:
  keyFile: /opt/st12/mongosec.key
  authorization: enabled

We also need to launch the MongoDB server with "--auth".  I've installed MongoDB as a service so that means editing /etc/systemd/system/multi-user.target.wants/mongod.service:

[Service]
Environment="OPTIONS=-f /etc/mongod.conf --auth"

After restarting the MongoDB service (systemctl restart mongod), I can still connect with mongosh but the warnings are gone; if I attempt to run commands, I'm told authentication is required:

To connect with a username:

mongosh mongodb://127.0.0.1:27017 -u sametimeUser

Finally, don't forget to change the default user/pass combination (sametimeUser/sametime) before going live!



Merry Christmas

by Richard Pajerski


Posted on Sunday December 25, 2022 at 12:00AM in General


And she shall bring forth a son: and thou shalt call his name JESUS.  For he shall save his people from their sins.  (St. Matthew 1:21; Douay-Rheims version).


Image (public domain): The Nativity by Lorenzo Lotto (1523)


Possible bug with triggered NSFDBHOOK events in DOTS (on Windows 2019)

by Richard Pajerski


Posted on Friday December 23, 2022 at 01:13PM in Technology


[February 2023 update: DOTS follow-up, SPR for applet bug]

I recently took advantage of DOTS being back in the Domino 12 server, to replace a Java agent with a scheduled DOTS tasklet and have been pleased with the results.  Using tasklets is generally going to be far more efficient than using Java agents in Domino since a JVM is loaded once with the DOTS server task and remains resident in memory until the DOTS task is stopped whereas with each agent invocation a new instance of the JVM is started.  There are other benefits to using tasklets over Java agents which I may take up in a future post but for the moment, I've run across an issue on a Windows 2019 server installation.

Although the deployment above uses a scheduled tasklet, I was originally hoping to use the triggered NSFDBHOOK events in order to capture some document saves in (more/less) real time.  But while testing on Windows 2019, I noticed that the HOOK_EVENT_NOTE_UPDATE and HOOK_EVENT_NOTE_OPEN events were not being emitted at all or only very infrequently.  I had earlier tested the same tasklet on a Domino installation on a Windows 8.1 client and the events fired more/less as expected.  Aside from the OS difference, everything about the Domino installations was identical -- with one exception: the Domino program installation directory on the Windows client had no spaces but the Windows server was installed in the default C:\Program<space>Files\HCL directory.  Sure enough, after reinstalling Domino on the Windows 2019 server without the space (specifically in C:\Domino), events began firing again.  HCL has also reproduced this and may open an SPR.

In the meantime, after working a bit more with those NSF hook events, my impression is that they are not altogether reliable -- or at least, there doesn't appear to be a one-to-one correlation with each document save/open and a DOTS-generated event.  Some document saves/opens never fire an event.  The source code for the older versions of DOTS is on openntf.org here: https://stash.openntf.org/projects/DOTS/repos/dots/browse/sources but I'm not sure if this is the same code being shipped with the Domino 12 server (though I assume it's pretty close).

If I'm looking in the right place, lines 79 and 80 of the postMessage method (https://stash.openntf.org/projects/DOTS/repos/dots/browse/sources/dotsNSFHook.cpp), have:

STATUS error = MQOpen(queueName, 0, &dotsmq);
 if ( error == NOERROR ){

where DOTS presumably intercepts the necessary events from an internal Domino queue.  But what if there *are* errors here?  Will our DOTS tasklets ever know about them?  Maybe errors are unlikely here but perhaps this is the source of some missed events.


Java applets in Notes 64-bit client not loading

by Richard Pajerski


Posted on Wednesday December 21, 2022 at 07:17PM in Technology


[February 2023 update: DOTS follow-up, SPR for applet bug]

For the first time in the history of Notes, HCL last month released a fully supported 64-bit version of the Notes standard, Domino Designer and Domino Administrator clients with release 12.0.2.  Overall I've found it to be more stable and certainly faster than its 32-bit counterpart and so I now use it regularly.  However, it's not without its issues with reports popping up here and here.  And I have another to add: Java applets won't load in the 12.0.2 64-bit client.  I submitted a ticket to HCL and they could reproduce this so they're preparing an SPR.

A notable aspect of this bug is that there are no error logs (that I could find) to indicate something's wrong.  Nothing in the Java Debug console, the IBM_TECHNICAL_SUPPORT folder, log.nsf, etc.  You will see the Java coffee cup but I think most end users will not immediately interpret it as a problem:



This issue is probably not an inconvenience for most deployments since Java applets were never widely implemented in Notes (in my experience).  But where applets are used, they can bring quite a bit of power (e.g. custom interfaces for any third-party system with a Java API -- databases, message queues and so on).  The good news is that applets do still work in 32-bit Notes 12.0.2 and will likely be supported in Notes as long as Java 8 remains the default runtime.



Traveler 12 expired APNS certificates

by Richard Pajerski


Posted on Wednesday December 21, 2022 at 03:07PM in Technology


It looks like the expiration date for APNS p12 certificates that shipped with Traveler 12.0.1 was on or about December 19, 2022.  If you have a Traveler 12.0.1 (November 2021) installation and started seeing Domino console messages similar to:

[1034:0002-1038] 12/21/2022 01:38:08 PM  Traveler: SEVERE <User> Unable to get the PushNotificationResponse for apnsId null Exception Thrown...


on or after that date, the resolution is to apply Traveler 12.0.1 Fix Pack 2 which includes new APNS p12 certificates that expire in September 2023.  Until that fixpack gets applied (or you upgrade to Traveler 12.0.2 which also contains updated certificates), iOS users will no longer receive notifications of new email on their devices.

More here:  What's new in Traveler 12.0.1 Fix Pack 2?


Happy Easter

by Richard Pajerski


Posted on Sunday April 17, 2022 at 12:00AM in General


And then, when he sat down at table with them, he took bread, and blessed, and broke it, and offered it to them; whereupon their eyes were opened, and they recognized him.  (St. Luke 24:30; Knox Version).

Image (public domain): Supper at Emmaus by Matthias Stom


Merry Christmas

by Richard Pajerski


Posted on Saturday December 25, 2021 at 12:00AM in General


This is the sign by which you are to know him; you will find a child still in swaddling-clothes, lying in a manger.
(Luke 2:12; Knox Version).

Image (public domain): L'Adoration des Bergers by Georges de La Tour


Brief overview of modern (2021) server-side development landscape in Domino

by Richard Pajerski


Posted on Thursday October 07, 2021 at 08:21PM in Technology


Among the technical reasons Domino has enjoyed longevity in the application server market are its stability and reliability.  But of course technology changes rapidly and being able to successfully adapt to new trends has also kept Domino relevant over the years.  Striking a balance between trendy and relevant is not always obvious but the stewards of Domino have generally taken a conservative approach to introducing and supporting new technology which continues to benefit the product in the immediate and long term.

Very briefly then, beyond the tried-and-true world of Notes client server application development, let's look at three modern technology options developers can choose from in 2021:

1.  Domino AppDev Pack (https://doc.cwpcollaboration.com/appdevpack/docs/en/homepage.html)

From the site:  "The AppDev Pack primarily adds Node.js support to HCL Domino Server."

So developers already familiar with or wanting to explore the JavaScript-centric Node.js have a custom-designed set of tools for programmatically and securely accessing Domino applications and data.


2.  Domino REST API (Project Keep) (https://opensource.hcltechsw.com/domino-keep-docs/)

From the site: "Domino REST API is designed to re-establish Domino as a world class, modern, standards-compliant, cloud native and enterprise-level collaboration platform. It adds contemporary REST APIs to Notes and Domino, enabling a modern programming experience with the tools of your choice."

This is still in beta but will hopefully be out in Domino 12.0.1 later this fall.  Domino has for many years had the ability to offer data via a REST API (Domino Access Services) but Keep modernizes that effort by implementing (among other things) OpenAPI and JWT Authorization.  In addition, developers will be able to introduce their own server-side modules called "verticles" as Keep runs on top of Vert.x.


3.  Tasklets with DOTS - Domino OSGi Tasklet Service (https://help.hcltechsw.com/domino/12.0.0/admin/wn_dotsredux.html)

From the documentation: "DOTS is a generic Domino add-in task that lets users create Domino server tasks by creating a tasklet container using Java OSGi plugins."

Ok, this is not exactly modern -- DOTS was an OpenNTF project that's been available since Domino 8.5.3.  Although officially dropped in the Domino 10/11 era it was recently updated and re-introduced in Domino 12.

Strictly-speaking, DOTS is the Domino server task that manages the tasklets which are Java server-side plugins.  Tasklets use a standard mechanism for starting/stopping (OSGi-defined) which makes them similar to Java agents but have the additional benefits of (a) not being tied to a specific .nsf file, (b) not requiring a full JVM reload on every execution and (c) better access to the Domino C API.


How are you developing Domino server-side code these days?


Notes client pegs one logical processor at 15%

by Richard Pajerski


Posted on Friday June 18, 2021 at 03:38PM in Technology


Having recently installed a Notes/Designer/Admin 12 client on Windows 8.1 Pro on an aging Intel i7 Quad-Core (with eight logical processors), I was surprised to see that after startup, Notes was consistently grabbing one logical processor and pegging it at around 15%.  Windows Task Manager showed that nlnotes.exe was the process and it wouldn't let go of that processor until Notes was closed:



Notes, Designer and Admin clients all worked fine and interaction with local- and server-based applications was normal.  Without giving it too much thought, I tried a few things like removing cache.ndk, stopping a couple Notes-related services and making sure the preference "Enable scheduled local agents" was disabled.

But none of that worked and strangely, Disk and Network utilization were both at 0%:



The client was set up in the normal way by connecting to a Domino server with an existing mail file on the server.  However, this workstation needed to use a Location that sends and receives mail from a POP3 server instead of Domino.  For that purpose I used an existing names.nsf that already had Account and Locations documents in place.  All of that connectivity worked and the mail flowed normally.

The next step was internet search but nothing obvious jumped out and most references to similar problems ended with Notes client crashes which I was not experiencing.

The Location document for this POP3 configuration kicks off replication and runs it every 10 minutes.  I noticed that after starting the client, there was a gap of a few seconds where the nlnotes.exe process was at 0% and didn't go up to 15% until replication started (and then stayed there).  Thinking the culprit was the Replicator, I disabled replication and restarted Notes... but nlnotes.exe was back to 15%!

But this time I could clearly see that process spiked when "Notes configuration settings have been refreshed" scrolled across the Status bar:


Based on that message and the fact that a POP3 configuration like this is not commonly used, I kept pursuing the Location document as the source of the problem.  And the problem was indeed there.

When you configure the Notes client for POP3 mail retrieval, only the "Mail" tab of the Location document needs to be filled out:



The "Servers" tab can remain empty -- and that was the problem!  At a minimum, the "Home/mail server" field MUST have some value in it to calm down the processor:

It doesn't matter if the server is down or the value entered isn't even a Domino server -- nlnotes.exe will report that the server is not responding but it leaves the processor alone after that:



Ok, problem solved, back to work.  :-)