【发布时间】:2015-07-07 16:34:21
【问题描述】:
我在超级开发模式下使用 GWT 2.6.0(在 Linux 上使用 IntelliJ Idea 14 + Chrome 43.0.2357.130(64 位))。
在页面加载过程中,Chrome 控制台出现异常
Uncaught java.lang.ClassCastException Impl.java:99
(anonymous function) @ Impl.java:99
gwtOnLoad @ oldstar-0.js:87303
(anonymous function) @ ClassLiteralHolder.java:23
Impl.java:99 是 throw e; 在com.google.gwt.core.client.impl.Impl
public static native JavaScriptObject entry(JavaScriptObject jsFunction) /*-{
return function() {
try {
return @com.google.gwt.core.client.impl.Impl::entry0(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)(jsFunction, this, arguments);
} catch (e) {
// This catch block is here to ensure that the finally block in entry0
// will be executed correctly on IE6/7. We can't put a catch Throwable
// in entry0 because this would always cause the unhandled exception to
// be wrapped in a JavaScriptException type.
throw e;
}
};
}-*/;
oldstar-0.js:87303 在生成的 oldstar-0.js 中是 $entry(init_2)();
function gwtOnLoad(errFn, modName, modBase, softPermutationId){
$moduleName = modName;
$moduleBase = modBase;
if (errFn)
try {
$entry(init_2)();
}
catch (e) {
errFn(modName);
}
else {
$entry(init_2)();
}
}
package com.google.gwt.lang;
final class ClassLiteralHolder {
}
还有 init_2() 这是对init() in EntryMethodHolder.java的引用
package com.google.gwt.lang;
/**
* This class holds the boot strap entry method that the compiler generates.
*/
public class EntryMethodHolder {
public static final void init() {
// Filled in by the compiler to call entry methods.
}
}
【问题讨论】:
-
我会添加一个 UncaughtExceptionHandler。在此处查找有关登录 GWT 的非常好的帖子:summa-tech.com/blog/2012/06/11/…
标签: javascript java debugging gwt