Domino Java Agent to Connect to Web Service

I am finally getting to work on some Java with Domino, but I’m still very new to this and have run into a wall. I’m hoping someone may offer some insight/advice.

I need to connect from my Notes database to a web service to request a special ID. The target web service requires an SSL connection and authentication using an application certificate – a java keystore (.jks) file that is stored in the Domino\Data directory on the server – and returns an bit of xml in response.

After some setup code the agent attempts to set some system properties with the information needed to make the connection to the external web service:

System.setProperty(“javax.net.ssl.keyStore”, m_keystorepath);

… where m_keystorepath is a variable pointing to the .jks file in the domino/data directory (ex: D:\Lotus\Data\filename.jks)

When the code gets to this line the agent fails and simply prints to the log file:

Agent printing: Error: java.lang.NullPointerException

I know the agent fails on this line of code because I have a println statement before it which works, and after it which is never reached.

For other errors I got a stack trace which gave more details and traced the error back to a particular line of code. For this I get only the line above. Since the error is the nullpointerexception and not errors related to authorization or authentication, I’m not sure what the problem may be.

I know the variables are set because that’s what I print out immediately before the call to set the system property.

I added the java 1.4.2 jsse.jar file to the C:\Lotus\Domino\jvm\lib\ext directory on the server to ensure the javax.net.ssl classes are in the classpath

I added the import statements to the agent to use the classes:

import javax.net.*;

import javax.net.ssl.*;

I used the ‘edit project’ button for the domino java agent to import the jsse.jar file for the agent.

There’s probably something I’ve overlooked – and I may have done things I didn’t need to do – so if anyone with experience can offer suggestions or a solution, any assistance will be greatly appreciated.

Thanks

Subject: Domino Java Agent to Connect to Web Service

I would check the java.policy file to make sure you are allowed to set that system property.

Subject: Domino Java Agent to Connect to Web Service – UPDATE

I found the java.policy file on the server at Lotus\Domino\jvm\lib\security. The following is some of the information included:

// Standard extensions get all permissions by default

grant codebase “file:${java.home}/lib/ext/*” {

permission java.security.AllPermission;

};

// Allows everyone to listen on unprivileged ports

permission java.net.SocketPermission “localhost:1024”, “listen”;

// Standard properties that can be read by anyone

permission java.util.PropertyPermission

There are no javax.net.ssl properties listed. Do I need to the list of properties I want to set to this list?

I noticed all the existing properties are set to “read”; can I also set to “write”?

Would I add something like:

permission javax.net.ssl.PropertyPermission “javax.net.ssl.keyStore”,“read”;

permission javax.net.ssl.PropertyPermission “javax.net.ssl.keyStore”,“write”;


OK, after a little research I think what I need to do is add:

permission java.util.PropertyPermission “javax.net.ssl.*”, “read, write”;

Does that seem correct?

Subject: RE: Domino Java Agent to Connect to Web Service – UPDATE

looks ok… did it work?

Subject: RE: Domino Java Agent to Connect to Web Service – UPDATE

It did work. All is well.

Subject: Domino Java Agent to Connect to Web Service

As quick test to see if its your variable hard code your string into the failing statement.

Subject: RE: Domino Java Agent to Connect to Web Service

Forgot to mention that I have tried this already. The variable does not seem to be the problem.