Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Eclipse中的GWT-加载模块时出错_Java_Gwt_Module_Enums - Fatal编程技术网

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

Java Eclipse中的GWT-加载模块时出错,java,gwt,module,enums,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 c

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

以下是问题的一些可能性

  • 确保已将gwt.xml文件放在anacom包下。i、 e anacom/gwt.xml
  • 您已经在gwt.xml中添加了
  • 使枚举可序列化,即

    公共枚举Modo实现可序列化{

    利加多,德斯利加多,奥克帕多,沉默

    }

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

    public Modo () {
        }
    

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

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

    因此,我猜使用enum和dto的解决方案具有相同的包。我还将域文件夹包含在模块文件中

    谢谢大家帮助我。

    1。确保项目包含包anacom.domain.Modo必须有一个gwt.xml文件,并且应该从启动项目中引用它 2.确保客户端未引用服务器端包中的任何对象类型 您知道gwt应用程序由两到三个主要部分组成,即客户端、服务器和共享包。通常,客户端应用程序不会根据设计原则引用服务器包中的类型。你也可以考虑这个细节。


    对于此示例,键入“anacom.domain.Modo”似乎与服务器端软件包中的一样。

    您是在客户端还是服务器上使用
    anacom.domain.Modo
    ?如果在客户机上,您需要的是源代码,而不仅仅是类文件。@TravisWebb我在这两者上都使用,按类来说,我的意思是我有java文件。你是指那个吗?我编辑了我的答案。可能是第一个项目将帮助您感谢提示,尝试了所有提示,但不幸的是问题仍然存在:(如果问题只是将新包添加到gwt.xml中的源设置中,那么瞧!)!
    public Modo () {
        }