You probably need to increase the security level for the agent. To be able to access the file system from the agent.
Cannot access file system from Java Agent
-
04-10-2022 - |
문제
I want to check in the file system if file exists. This code is working in SSJS and I can correctly see if the file exists or not:
var filePath = "/folder/temp.xlsx";
var inStream:NotesStream = session.createStream();
if( inStream.open(filePath,"ASCII") ){
if( inStream.getBytes()>0 ){
....
}else{...}
}else{...}
but this code, looking for the exaxt same file is not working in an agent: (!!)
Session session = getSession();
Stream inStream = session.createStream();
String filePath = "/folder/temp.xslx";
if( inStream.open(filePath,"ASCII")){
if(inStream.getBytes()>0){
...
}else{...}
}else{...}
It always goes into the 2nd else which means that inStream.open(file...) is false.
what is the difference between xpages file access and agent file access? any solutions?
해결책
다른 팁
You might have to edit the permissions in your JVM.
Edit the file java.policy in the lib/security/ directory of the JVM of Lotus Domino. For instance C:\Program Files\IBM\Lotus\Notes\jvm\lib\security\java.policy
For testing you can grant all permissions like this:
grant {
permission java.security.AllPermission;
};
You have to restart the JVM. Most simple is to restart the server. But perhaps restarting http will do.