LoginRequiredCallback instantiation issue

SmartGWT Power 2.3
GWT 1.7.1

I have been having issues with this for some time and have not gotten any feedback from support. I thought I got past this issue in another posting, but it turned out to be a false start. I have done more investigation and nothing seems obvious to me, so I would hope someone in support could jump in to help shed some light on my issue.

Basically I’m having a problem with the following code in my MainEntryPoint.java class:

RPCManager.setLoginRequiredCallback(new LoginRequiredCallback() {

            public void loginRequired(int transactionNum, com.smartgwt.client.rpc.RPCRequest request, com.smartgwt.client.rpc.RPCResponse response) {
                SC.say("TZ", "You have been logged out, do you want to proceed to login page?", new BooleanCallback() {
                    public void execute(Boolean value) {
                        if(value != null && value) {
                            Window.Location.replace(GWT.getHostPageBaseURL() + "login.jsp");
                        }
                    }
                });
            }
        });

This code throws the following error in the GWT Console:

[ERROR] Unable to load module entry point class com.ancerno.tz.client.MainEntryPoint (see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (TypeError): Object expected
 number: -2146823281
 description: Object expected
	at com.smartgwt.client.rpc.RPCManager.setLoginRequiredCallback(Native Method)
	at com.ancerno.tz.client.MainEntryPoint.onModuleLoad(MainEntryPoint.java:78)

From reading the error, it looks as if creating an instance of LoginRequiredCallback is failing for some reason. So I wanted to see what I was getting back when I create a new instance of LoginRequiredCallback:

LoginRequiredCallback lrc = new LoginRequiredCallback() {

            public void loginRequired(int transactionNum, RPCRequest request, RPCResponse response) {
                SC.say("TZ", "You have been logged out, do you want to proceed to login page?", new BooleanCallback() {
                    public void execute(Boolean value) {
                        if(value != null && value) {
                            Window.Location.replace(GWT.getHostPageBaseURL() + "login.jsp");
                        }
                    }
                });
            }

        };

        GWT.log("LRC:" + lrc.getClass().toString(), null);

        RPCManager.setLoginRequiredCallback(lrc);

The GWT.log() call in the code above returns

[INFO] LRC:com.ancerno.tz.client.MainEntryPoint$1@18f3fb1

I would have expected lrc to be of type LoginRequiredCallback and not MainEntryPoint?

Now to make matters more worse, when I add the SmartGWT console code:

if (!GWT.isScript()) {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");

            Page.registerKey(debugKey, new KeyCallback() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
	}

Into the MainEntryPoint.onModuleLoad() method as follows:

if (!GWT.isScript()) {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");

            Page.registerKey(debugKey, new KeyCallback() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
	}

        LoginRequiredCallback lrc = new LoginRequiredCallback() {

            public void loginRequired(int transactionNum, RPCRequest request, RPCResponse response) {
                SC.say("TZ", "You have been logged out, do you want to proceed to login page?", new BooleanCallback() {
                    public void execute(Boolean value) {
                        if(value != null && value) {
                            Window.Location.replace(GWT.getHostPageBaseURL() + "login.jsp");
                        }
                    }
                });
            }

        };

        GWT.log("LRC:" + lrc.getClass().toString(), null);

        RPCManager.setLoginRequiredCallback(lrc);

The error goes away in the GWT Console? The GWT.log() call to print out the class of lrc still shows:

[INFO] LRC:class com.ancerno.tz.client.MainEntryPoint$2

Could someone from support help me out? Why does the SmartGWT Console code eliminates the original error I was seeing in the GWT Console? How can I get past this issue?

Between this and your post about logging suddenly vanishing, neither of which make any sense, we’d say your project and/or IDE is corrupt. The best solution is to rebuild the project from scratch.

Ok, thanks for looking at both of my issues.