我已经创建了一个GWT 2.6项目,我想向它添加GXT。我首先尝试使用3.0.1但后来我发现它存在兼容性问题所以我改为GXT 3.1测试版。
但是当我尝试运行应用程序时,我遇到了这些错误:
我所做的更改是在模块xml中注释掉这一行
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
并添加了以下内容:
<inherits name='com.sencha.gxt.ui.GXT' />
<!-- GXT Stylesheet -->
<stylesheet src="reset.css" />
有人有想法吗?
gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='comav200'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.clean.Clean'/> -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<inherits name='com.google.gwt.user.theme.dark.Dark'/>
<inherits name="com.google.gwt.json.JSON" />
<!-- Other module inherits -->
<inherits name="com.google.gwt.json.JSON" />
<inherits name='com.sencha.gxt.ui.GXT' />
<!-- GXT Stylesheet -->
<stylesheet src="reset.css" />
<!-- Specify the app entry point class. -->
<entry-point class='com.coma.client.Main'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe"/>
</module>
堆栈跟踪
maj 02, 2014 7:17:00 EM java.util.prefs.WindowsPreferences <init>
Varning: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[WARN] Server class 'org.eclipse.jetty.servlet.listener.ELContextCleaner' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/C:/Users/JoHanSolo/Documents/eclipse%20ee/plugins/com.google.gwt.eclipse.sdkbundle_2.6.0/gwt-2.6.0/gwt-dev.jar' to the web app classpath for this session
For additional info see: file:/C:/Users/JoHanSolo/Documents/eclipse%20ee/plugins/com.google.gwt.eclipse.sdkbundle_2.6.0/gwt-2.6.0/doc/helpInfo/webAppClassPath.html
[WARN] 404 - GET /%7Bmodule%20name%7D/reset.css (127.0.0.1) 1394 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1:8888/Comav200.html?gwt.codesvr=127.0.0.1:9997
Connection: keep-alive
Response headers
Content-Type: text/html;charset=ISO-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1394
Exception in thread "Thread-1" java.lang.NullPointerException
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.JavaScriptException.getExceptionName0(JavaScriptException.java)
at com.google.gwt.core.client.JavaScriptException.getExceptionName(JavaScriptException.java:66)
at com.google.gwt.core.client.JavaScriptException.ensureInit(JavaScriptException.java:203)
at com.google.gwt.core.client.JavaScriptException.getMessage(JavaScriptException.java:187)
at com.google.gwt.dev.util.log.AbstractTreeLogger.getStackTraceAsString(AbstractTreeLogger.java:70)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient.generateLogData(ViewerServiceClient.java:296)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient.addLogEntry(ViewerServiceClient.java:118)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger.sendEntry(ViewerServiceTreeLogger.java:158)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger$PendingLog.send(ViewerServiceTreeLogger.java:72)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger.initLogHandle(ViewerServiceTreeLogger.java:134)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger$1.onDone(ViewerServiceTreeLogger.java:145)
at com.google.gwt.dev.shell.remoteui.ViewerServiceTreeLogger$1.onDone(ViewerServiceTreeLogger.java:143)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient$1.onDone(ViewerServiceClient.java:96)
at com.google.gwt.dev.shell.remoteui.ViewerServiceClient$1.onDone(ViewerServiceClient.java:94)
at com.google.gwt.dev.shell.remoteui.MessageTransport$PendingRequest.setResponse(MessageTransport.java:124)
at com.google.gwt.dev.shell.remoteui.MessageTransport.processServerResponse(MessageTransport.java:428)
at com.google.gwt.dev.shell.remoteui.MessageTransport.processMessage(MessageTransport.java:404)
at com.google.gwt.dev.shell.remoteui.MessageTransport.access$400(MessageTransport.java:44)
at com.google.gwt.dev.shell.remoteui.MessageTransport$3.run(MessageTransport.java:327)
at java.lang.Thread.run(Unknown Source)
答案 0 :(得分:0)
请检查您的module-xml文件并添加(如果尚未存在):
<inherits name='com.google.gwt.user.User' />
答案 1 :(得分:0)
我在gwt.xml
<inherits name="com.google.gwt.json.JSON" />
两次。 无效
http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd
尝试以下选项
在DTD URL下方使用
https://raw.githubusercontent.com/gwtproject/gwt/2.6.0/distro-source/core/src/gwt-module.dtd
或在您的gwt.xml中添加<set-property name="user.agent" value="gecko1_8"/>
。添加更多用户代理,如下所述。
欲了解更多信息,请查看以下链接:
- 编辑 -
首先尝试gwt.xml
以下
...
<module rename-to='comav200'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.sencha.gxt.ui.GXT' />
<inherits name="com.google.gwt.json.JSON" />
<stylesheet src="reset.css" />
<entry-point class='com.coma.client.Main' />
<source path='client' />
<source path='shared' />
</module>
GWT 2.5.0
对我来说很好。请查看以下屏幕截图中的lib
文件夹。
<?xml version="1.0" encoding="UTF-8"?>
<!-- When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities. -->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='gxtproject'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.sencha.gxt.ui.GXT' />
<stylesheet src="reset.css" />
<entry-point class='com.gxt.client.GXTProject' />
<source path='client' />
<source path='shared' />
<inherits name="com.google.gwt.json.JSON" />
</module>