Question

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?

Was it helpful?

Solution

You probably need to increase the security level for the agent. To be able to access the file system from the agent.

enter image description here

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top