erratic failure of sessionAsSignerWithFullAccess

2019-08-06 09:27发布

问题:

The code below is a some test code that I have in an action button on an XPage. I need to get a handle on the current database with FullAccess in the code WFSUtils.sysOut just formats a printed message to the server console. Periodically the error message in the catch returns 2015-01-09 12:49:11 PM HTTP JVM: WFS ~~~ Error in Update Demo 'sessionAsSignerWithFullAccess' not found

I am the signer of the XPage and the database is signed by the server ID. Sometimes it runs through just fine other time it fails with the message above. If I shut everything down then restart it will generally run but then start failing. It is very random and unpredictable.

debug = true;
try{

    if (debug) WFSUtils.sysOut("Starting YYY New SetupDemo");
    var serverName = database.getServer();
    var repID = database.getReplicaID();
    thisDB = sessionAsSignerWithFullAccess.getDatabase("","");
    thisDB.openByReplicaID(serverName,repID); 
    if (debug) WFSUtils.sysOut( "SetupDemo Success" + thisDB.getTitle());
}catch(e){
    WFSUtils.sysOut("Error " + e.toString())
}finally{
    try{
        WFSUtils.recycleObjects([]);
        if (debug) WFSUtils.sysOut("SetupDemo Recycle Success");
    }catch(e){
        if (debug) WFSUtils.sysOut("SetupDemo recycle Failed");
    }

}

回答1:

For one reason or another, it's important that all XPage elements be signed by the same ID when running. When they're not, sessionAsSigner and sessionAsSignerWithFullAccess get erratic as you describe - that may be the cause.