论坛首页 入门技术论坛

Unable to load module entry point class 错误求解

浏览 4253 次
该帖已经被评为新手帖
作者 正文
   发表时间:2008-03-18  
GWT
我在用GWT写一个验证用户是否存在的ajax应用,在html中并没有修改eclipse生成的任何内容,直接在java中添加的Label和TextBox,并没有用RootPanel.get引用HTML页面中的任何元素,但仍抛出了下列异常:

ERROR] Unable to load module entry point class com.ibm.register.client.Register (see associated exception for details)
java.lang.NullPointerException: null
at com.ibm.register.client.Register.onModuleLoad(Register.java:20)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:342)
at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:326)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$200(BrowserWidgetIE6.java:36)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:70)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:125)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:293)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:196)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)

我的java代码如下:

package com.ibm.register.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FocusListener;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class Register implements EntryPoint {

TextBox input;
Label userdes,statedes,state;
public void onModuleLoad() {

input = new TextBox();
input.setVisibleLength(20);
userdes.setText("User:");// 这个是20行
statedes.setText("State:");
state.setText("Ready.");


input.addFocusListener(new FocusListener(){

public void onFocus(Widget sender){

}
public void onLostFocus(Widget sender){
RegisterServiceAsync rsa = RegisterService.Util.getInstance();
rsa.isExist(input.getText(), new StringCallBack());
}
});

HorizontalPanel panelUp,panelDown;
panelUp = new HorizontalPanel();
panelDown = new HorizontalPanel();
panelUp.add(userdes);
panelUp.add(input);
panelDown.add(statedes);
panelDown.add(state);
RootPanel.get().add(panelUp);
RootPanel.get().add(panelDown);
}

public class StringCallBack implements AsyncCallback{

public void onFailure(Throwable arg0) {
state.setText("Error!");
}
public void onSuccess(Object arg0) {
int result = ((Integer)arg0).intValue();
if(result == 1)
state.setText(input.getText()+" hava exist.");
else
state.setText("Valid user.");
}

}
}

大家帮忙看看哪里错了呢……
   发表时间:2009-02-13  
userdes 没有创建 userdes = new Lable() ;

0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics