【问题标题】:GWT Error ! No source code is available for type org.w3c.dom.NodeGWT 错误! org.w3c.dom.Node 类型没有可用的源代码
【发布时间】:2012-07-12 02:47:09
【问题描述】:

我在 GWT 编译期间遇到此编译错误。我正在使用它来解析 XML 文档。

[ERROR] Line 24: No source code is available for type org.w3c.dom.Node; did you forget to     inherit a required module?
[ERROR] Line 28: No source code is available for type org.w3c.dom.NodeList; did you forget to inherit a required module?
[ERROR] Aborting compile due to errors in some input files

根据我对此进行的任何研究,它表明类路径可能丢失,但由于默认情况下这将包含在 gwt-user.jar 和 JRE7 中,而且我也没有包含任何外部 jar,所以没有重复的情况!而且您不能在客户端代码中包含这些类型的代码,因为它将被转换为 javascript

我有一个类在我的共享文件夹(GWT Model View Presenter Project structure)中使用这个节点,它基本上是一个模型!

  1. 将代码移动到服务器端是唯一可能的解决方案吗?
  2. 如果 1 为真,我将如何重构访问此模型的客户端演示者,而无需每次都进行 RPC 调用的开销?

  3. 是否有任何替代方法?


我的 GWT 配置文件。

 <module rename-to='xxxxx'>
 <inherits name='com.google.gwt.user.User'/>


 <inherits name='com.google.gwt.user.theme.standard.Standard'/> 
 <inherits name="com.google.gwt.xml.XML" />

  <entry-point class='com.xxxx.xxxxx.gwt.client.ProjectEntry'/>


  <source path='client'/>
  <source path='shared'/>

 </module>

编辑:我现在已经包含了 xml 继承!它的工作原理

【问题讨论】:

  • 你能发布你的 GWT 模块配置文件吗?

标签: java xml gwt rpc


【解决方案1】:

在您的代码库的某个地方,您正在使用 org.w3c.dom.Node 和 org.w3c.dom.NodeList 这些没有列入白名单。换句话说,你不能使用这些类!见;

https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation

您应该将这些包用于 xml;

import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;
import com.google.gwt.xml.client.XMLParser;

【讨论】:

  • 感谢您的快速回复,但现在它说- [错误] 第 25 行:没有可用于类型 com.google.gwt.xml.client.Node 的源代码;你忘了继承一个必需的模块吗? [错误] 第 29 行:com.google.gwt.xml.client.NodeList 类型没有可用的源代码;你忘了继承一个必需的模块吗?
  • 通过添加 gwt.xml 模块解决的问题
  • 很好 :) 想通了!但现在我有一些关于 java.util 集合的问题!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多