1

我有一个我制作的 java 应用程序,这周我尝试将 GWT 添加到它。尝试在 GWT Designer 中查看我的课程时出现此错误:

Error loading module(s).

GWT Designer can't load a module because of error in gwt.xml module description, incorrect resource which requires processing with GWT generator or by some other configuration error.

Please check your $project_dir/.gwt/.gwt-log for GWT-specific errors (not GWT Designer errors).

This log has the following error messages:



   [ERROR] Errors in 'file:/C:/Temp/essd/Projecto/anacom/src/main/java/anacom/shared/dto/OutputObterModoDto.java'

      [ERROR] Line 8: No source code is available for type anacom.domain.Modo; did you forget to inherit a required module?

   [ERROR] Errors in 'file:/C:/Temp/essd/Projecto/anacom/src/main/java/anacom/shared/dto/TelemovelDetalhadoDto.java'

      [ERROR] Line 8: No source code is available for type anacom.domain.Modo; did you forget to inherit a required module?

   [ERROR] Errors in 'file:/C:/Temp/essd/Projecto/anacom/src/main/java/anacom/shared/exception/TelemovelModoException.java'

      [ERROR] Line 17: No source code is available for type anacom.domain.Modo; did you forget to inherit a required module?

   [ERROR] Errors in 'file:/C:/Temp/essd/Projecto/anacom/src/main/java/anacom/shared/dto/OutputObterModoDto.java'

      [ERROR] Line 8: No source code is available for type anacom.domain.Modo; did you forget to inherit a required module?

   [ERROR] Unable to find type 'anacom.presentationserver.client.AnacomGWT'

      [ERROR] Hint: Previous compiler errors may have made this type unavailable

      [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

所有有该错误的文件都导入了类 anacom.domain.Modo。该类是一个枚举,仅包含以下内容:

package anacom.domain;

public enum Modo {
    LIGADO, DESLIGADO, OCUPADO, SILENCIO
}

此外,在 gwt.xml 中,我继承了模块并定义了入口点类。在过去的三天里,我一直在努力解决这个问题。如果你能帮助我,我将不胜感激。抱歉,如果这是一个新手问题,但在我通过网络搜索时,我没有找到解决方案。非常感谢!

4

3 回答 3

1

以下是问题的一些可能性。

  1. 确保已将 gwt.xml 文件放在 anacom 包下。即anacom/gwt.xml
  2. 您已<source path="domain">在 gwt.xml中添加
  3. 使您的枚举可序列化,即

    公共枚举 Modo 实现 Serializable {

    LIGADO、DESLIGADO、OCUPADO、SILENCIO

    }

或者

public enum Modo implements IsSerializable {
    LIGADO, DESLIGADO, OCUPADO, SILENCIO
    }

4)生成一个默认构造函数,即

public Modo () {
    }
于 2012-04-08T20:50:34.573 回答
1

好吧,我设法找到了解决方案。不是我所期望的,但它解决了这个问题。

我将枚举类移动到另一个包;DTO 和异常位于共享包下,然后位于它们各自的文件夹中。我在共享下创建了一个域文件夹。然后我改变了我的 dml 和我所有的其他类(相信我,这是一个本地和远程运行的大项目),所以引用的枚举就是这个。

所以我猜想枚举和 DTO 的解决方案是有相同的包。我还在模块文件中包含了域文件夹。

谢谢大家试图帮助我。

于 2012-04-12T22:01:52.873 回答
0

1.确保项目包含包anacom.domain.Modo必须有一个gwt.xml文件,你应该从你的启动项目中引用它

2.确保客户端不引用服务器端包中的任何对象类型

您知道 gwt 应用程序由两个或三个主要部分组成,它们是客户端、服务器和共享包。通常客户端应用程序不会根据设计原则引用服务器包中的类型。你也可以考虑这个细节。

对于此示例,键入“anacom.domain.Modo”似乎是在服务器端包中。

于 2013-08-02T06:09:53.650 回答