Java 不同类的GWT类方法未调用&;获得雨伞例外

Java 不同类的GWT类方法未调用&;获得雨伞例外,java,gwt,exception,uibinder,typeerror,Java,Gwt,Exception,Uibinder,Typeerror,我想从不同的类调用方法来导航页面 所以我将传递“UserID”和“Password”进行身份验证,然后它将导航到下一页 我的代码: public class Test2 extends Composite { HelloUIBinder hb; AnimationHelper animationHelper; TestPage tp; String strEmail, strPass; private static Test2UiBinder uiBinder = GWT.create(

我想从不同的类调用方法来导航页面

所以我将传递“UserID”和“Password”进行身份验证,然后它将导航到下一页

我的代码:

public class Test2 extends Composite {

HelloUIBinder hb;

AnimationHelper animationHelper;
TestPage tp;

String strEmail, strPass;

private static Test2UiBinder uiBinder = GWT.create(Test2UiBinder.class);

interface Test2UiBinder extends UiBinder<Widget, Test2> {
}

@UiField TextBox txtEmail;
@UiField PasswordTextBox txtPass;
@UiField Button btnLogin;

public Test2() {
    initWidget(uiBinder.createAndBindUi(this));

    btnLogin.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub

            strEmail = txtEmail.getText().toString();
            strPass = txtPass.getText().toString();

            Window.alert(strEmail);
            Window.alert(strPass);

            GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

                @Override
                public void onUncaughtException(Throwable e) {
                    // TODO Auto-generated method stub
                    Throwable un = unwrap(e);

                    Window.alert(un.toString());
                }
            });

            hb.onLogin(strEmail, strPass);
        }
    });
}

public Throwable unwrap(Throwable e)
{
    if(e instanceof UmbrellaException)
    {
        UmbrellaException ue = (UmbrellaException) e;
        if(ue.getCauses().size() == 1)
        {
            return unwrap(ue.getCauses().iterator().next());
        }
    }
    return e;
}
}
但是,在运行应用程序时,我收到错误消息:

"com.google.gwt.core.client.JavaScriptException: (TypeError): 'null' is not an object"
那么这个错误有什么问题呢

请尽快告诉我任何解决办法


提前感谢。

本质上我们有一个空点异常。到目前为止,onLogin中唯一可以为null的似乎是animationHelper,并且您没有发布任何代码来初始化它。但是,如果有stacktrace,情况会更可靠。您应该真正更改代码以提供跟踪。如果你需要更多的信息,你应该

  • 张贴stacktrace
  • 发布用于初始化animationHelper的代码

    • 本质上,我们有一个NullPointerException。到目前为止,onLogin中唯一可以为null的似乎是animationHelper,并且您没有发布任何代码来初始化它。但是,如果有stacktrace,情况会更可靠。您应该真正更改代码以提供跟踪。如果你需要更多的信息,你应该

      • 张贴stacktrace
      • 发布用于初始化animationHelper的代码
      "com.google.gwt.core.client.JavaScriptException: (TypeError): 'null' is not an object"