Eclipse中的GWT - 加载模块时出错

时间:2012-04-08 19:03:02

标签: java gwt module enums

我有一个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中,我继承了模块并定义了入口点类。 我花了最近三天试图解决这个问题。如果你能帮助我,我将不胜感激。很抱歉,如果这是一个新手问题,但在我通过网络搜索时,我还没有找到解决方案。非常感谢你!

3 个答案:

答案 0 :(得分:1)

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

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

    public enum Modo实现了Serializable {

    LIGADO,DESLIGADO,OCUPADO,SILENCIO

    }

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

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

    public Modo () {
        }
    

答案 1 :(得分:1)

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

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

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

感谢大家帮助我。

答案 2 :(得分:0)

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

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

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

对于此示例,请在服务器端程序包中键入“anacom.domain.Modo”。

相关问题