【发布时间】:2012-01-18 20:55:53
【问题描述】:
使用 UiBinder 的我的 GWT 应用无法在 Internet Explorer 中加载。但是,它可以在 Firefox、Safari 和 iPhone 上正常加载。
在试图找出问题所在的过程中,我一直在剔除部分内容,试图找出根本原因。我基本上是一个标签,它仍然在 FF 中有效,但在 IE 中无效。
这是EntryPoint:
public class Core implements EntryPoint {
private static Core instance;
public static Core instance() {
return instance;
}
@Override
public void onModuleLoad() {
instance = this;
RootPanel container = RootPanel.get("container");
container.add(new Label("hi"));
}
}
这是我的 index.jsp:
<!doctype html>
<html>
<head>
<script type="text/javascript" src="core/core.nocache.js"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
这是我的 appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>realAppNameHere</application>
<version>andrew</version>
<static-files>
<include path="**" />
<!-- The following line requires App Engine 1.3.2 SDK -->
<include path="**.nocache.*" expiration="0s" />
<include path="**.cache.*" expiration="365d" />
<exclude path="**.gwt.rpc" />
</static-files>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
这是我的 web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
即使有了这个精简版的一切,它仍然可以在 Firefox 中运行,但不能在 IE 中运行。现在甚至没有抛出任何错误,甚至在 Firebug 中也没有......它只是没有在 IE 中显示标签,但它会在 FF 中显示标签。我不知道为什么它没有运行。
有人知道吗?
编辑 3:
忘记了 module.gwt.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='core'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.ajaxloader.AjaxLoader'/>
<inherits name="com.google.gwt.logging.Logging"/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<entry-point class='com.company.core.client.Core'/>
<source path='client'/>
<source path='shared'/>
<set-property name="gwt.logging.logLevel" value="SEVERE"/>
<set-property name="gwt.logging.enabled" value="FALSE"/>
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
<set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />
</module>
【问题讨论】:
-
我不想听起来太明显,但是您是否将 IE 包含在您的 user.agent 属性中?在 .gwt.xml 文件中:例如
。 -
我希望这是显而易见的。我没有设置任何“user.agent”属性...但它可以在我提到的其他浏览器中运行...我错过了什么吗?
-
默认情况下,属性 user.agent 设置为包括所有浏览器,所以它肯定应该在 IE 中工作。
-
托管模式是否也发生错误?编译时,它是否正确构建了所有排列?
-
该错误消息很可能是线索 - IE 正在抛出异常,可能在 Button 的构造函数中,可能基于您正在绘制的按钮?您用来制作按钮的 uibinder xml 有什么特别之处吗?考虑发布您的 ui.xml 文件(如果没有帮助,可能还有您的模块文件本身)。