为什么会出现GXT异常以及如何修复它?

时间:2014-10-17 13:02:09

标签: java gwt gxt

我正在尝试创建一些简单的GWT + GXT应用程序。

  • GWT是2.6.1
  • GXT是3.1.0

我创造了简单的课程 MySampleApplication.java

public class MySampleApplication implements EntryPoint {
    public void onModuleLoad() {
        AlertMessageBox d = new AlertMessageBox("title", "message");
        d.show();
    }
}

和简单声明MySampleApplication.gwt.xml

<inherits name='com.google.gwt.user.User'/>
<inherits name='com.sencha.gxt.ui.GXT'/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<stylesheet src="reset.css" />
<entry-point class='com.mySampleApplication.client.MySampleApplication'/>

看起来没有什么比这更容易,但它失败了:

onModuleLoad() threw an exception
Exception while loading module com.mySampleApplication.client.MySampleApplication.
See Development Mode for details.
java.lang.reflect.InvocationTargetException at    
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at   
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at   
java.lang.reflect.Method.invoke(Method.java:483) at   
com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:411) at 
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at 
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at   java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ExceptionInInitializerError at com.mySampleApplication.client.MySampleApplication.onModuleLoad(MySampleApplication.java:9) ... 9 more
Caused by:
java.lang.RuntimeException: Deferred binding failed for 
'com.sencha.gxt.widget.core.client.box.MessageBox$MessageBoxIcons'
(did you forget to inherit a required module?) at 
com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53) at    
com.google.gwt.core.shared.GWT.create(GWT.java:72) at 
com.google.gwt.core.client.GWT.create(GWT.java:86) at 
com.sencha.gxt.widget.core.client.box.MessageBox.<clinit>(MessageBox.java:57) ... 10 more Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries) at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:610) at 
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:470) at 
com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49) ... 13 more 

1 个答案:

答案 0 :(得分:1)

删除GXT不支持的<inherits name='com.google.gwt.user.theme.clean.Clean'/>,请参阅Getting Started