1
votes

I have a JAVA Class that is defied as a managed-bean. The code below is a stripped down version of it:

package ca.wfsystems.core;

import lotus.domino.*;

public class Utils {

    public static void recycleObjects(Object... args) {
        for (Object o : args) {
            if (o != null) {
                if (o instanceof Base) {
                    try {
                        ((Base) o).recycle();
                    } catch (Throwable t) {
                        // who cares?
                    }
                }
            }
        }
    } //end recycleObjects

    public static void sysOut(Object msg){
        System.out.println(msg.toString());
    } //end sysOut
}// End Class

The call to recycleObjects(someObject) works fine when called from JAVA Code, but when I call it from SSJS in a button on an XPage called TestError I get the message "State data not available for /TestError because no control tree was found in the cache." The SSJS code in the button is:

WFSUtils().sysOut("In Button");
var vw:NotesView = WFSAppProperties().get(sessionScope.get("ssApplication")).getAppDB().getView("vwWFSForms");
WFSUtils().sysOut("Testing Bean" + vw.getName());
WFSUtils().recycleObjects(vw);

where WFSUtils is the name of the managed bean.

the error in the client says: Error while executing JavaScript action expression Script interpreter error, line=6, col=12: Java method 'recycleObjects(lotus.domino.local.View)' on java class 'ca.wfsystems.core.Utils' not found JavaScript code

I have searched for the error "State data not available for" but found a single reference aout it when using the Extension Library but this code does not use it.

1
I have answered the second part but I couldn't understand the first part. Where did you see the error message "State data not available for /TestError because no control tree was found in the cache."?Serdar Basegmez
Domino/workspace/logs/error-log-0.xml on the serrver.Bill F

1 Answers

5
votes

You are using varargs in your method.

It's not possible to use varargs from SSJS. Instead, you might call the same method as:

WFSUtils().recycleObjects([vw]);

It will work in that way.