Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/391.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/0/xml/14.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 GWT找不到自定义类?_Java_Xml_Eclipse_Gwt_Package - Fatal编程技术网

Java GWT找不到自定义类?

Java GWT找不到自定义类?,java,xml,eclipse,gwt,package,Java,Xml,Eclipse,Gwt,Package,我在互联网上浏览了很多次,似乎找不到一个直接的答案,只是想澄清一些事情 我需要我的web应用程序从服务器返回ArrayList。Por是一个自定义类,它实现了Serializable,并遵循我所能找到的关于GWT可序列化的所有规则 我的gwt.xml文件(在com.pbot包中)包含: 我所有的自定义类(包括Por)都在同一个com.pbot包中。但我仍然收到“没有可用于com.pbot.Por类型的源代码;您是否忘记继承所需的模块?”消息。我是否需要使用com.pbot作为源创建第二个gw

我在互联网上浏览了很多次,似乎找不到一个直接的答案,只是想澄清一些事情

我需要我的web应用程序从服务器返回ArrayList。Por是一个自定义类,它实现了Serializable,并遵循我所能找到的关于GWT可序列化的所有规则

我的gwt.xml文件(在com.pbot包中)包含:


我所有的自定义类(包括Por)都在同一个com.pbot包中。但我仍然收到“没有可用于com.pbot.Por类型的源代码;您是否忘记继承所需的模块?”消息。我是否需要使用com.pbot作为源创建第二个gwt.xml并导入它?如果是的话,我该怎么做?我应该把它放在哪里?如果没有,我错过了什么

完整的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.5.1//EN"
  "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module rename-to='pbot'>
  <!-- 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'/>     -->

  <!-- Other module inherits                                      -->

  <!-- Specify the app entry point class.                         -->
<entry-point class='com.pbot.client.Pbot'/>
  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>
  <source path='com.pbot'/>

</module>

添加


而不是

<source path='com.pbot'/>

但我仍然认为您应该将您的自定义类放入正确的包中,所以在将Por放入共享包的情况下(因为您在客户端和服务器端都使用Por)。然而,我不知道具体情况(如果你能做到的话),所以这只是一个建议

这背后的原因是,您提供的整个包com.pkg将被翻译成JavaScript,很快或稍后您就会因为这种态度而陷入麻烦。所以最好的办法是——若可能的话,将自定义类放入客户机或共享包中,然后删除


<source path=''/>
<source path='com.pbot'/>
<source path=''/>