lotus notes - NullPointerException in Java script library -


i making first step java- trying create simple java script library in domino designer 8.5.2 perform sftp file transfers using jsch 0.1.48. library called lotusscript agent via ls2j. here sftp class script library, based on this answer:

import com.jcraft.jsch.*;  public class sftp {     public string getfile(string host, string user, string pass,                            string localpath, string remotepath) {         jsch jsch = new jsch();         session session = null;         try {             session = jsch.getsession(user, host, 22);             session.setconfig("stricthostkeychecking", "no");             session.setpassword(pass);             session.connect();             channel channel = session.openchannel("sftp");             channel.connect();             channelsftp sftpchannel = (channelsftp) channel;             sftpchannel.get(remotepath, localpath);             sftpchannel.exit();             session.disconnect();         } catch (jschexception e) {             e.printstacktrace();         } catch (sftpexception e) {             e.printstacktrace();         }         string result = "ok";         return result;     } } 

when call function java agent, appears work without issues. when call lotusscript agent via ls2j, transfers file throws error 318 - ls2j error: threw java.lang.nullpointerexception. java stack trace is:

java.lang.nullpointerexception     @ lotus.notes.agentsecuritymanager.checkrelatedthreadgroup(unknown source)     @ lotus.notes.agentsecuritymanager.checkaccess(unknown source)     @ java.lang.thread.checkaccess(thread.java:378)     @ java.lang.thread.interrupt(thread.java:506)     @ com.jcraft.jsch.session.disconnect(session.java:1630)     @ sftp.getfile(unknown source)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:48)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:37)     @ java.lang.reflect.method.invoke(method.java:600)     @ lotus.domino.javaconnectinvoker.invoke(unknown source)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:48)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:37)     @ java.lang.reflect.method.invoke(method.java:600)     @ lotus.domino.javaconnectloader.invoke(unknown source) 

the issue seems session.disconnect() call. i've found others with similar issues calling jsch other applications, if it's jsch bug think java agent throw same exception. stack trace makes it's domino security issue, don't know adjustment make allow operation. agent set allow restricted operations, that's not it. forum post has similar stack trace , suggests issue may caused domino owning cleanup rights on thread group.

is there security change need make on domino side? can remove session.disconnect() without orphaning zillion connections on server?

the problem occurred in agentsecuritymanager, can read in this blog entry. it's shim domino amgr inserts jvm enforce domino's security policies.

check make sure have granted agent rights use restricted operations. (in example of lotus' oddball terminology, signer must have rights in "sign or run unrestricted methods , operations" field of server document, agent must have rights granted on security tab of agent properties box "allow restricted operations")

if it's not simple that, suggest try taking jar(s) com.jcraft.jsch.* out of domino script library , putting them in jvm/lib/ext folder on server's filesystem. security jars stored on filesystem handled different, , might around problem.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -