2010-11-25 54 views
0

我开始将GWT用于类项目,并且想知道RPC的实际使用情况。所以,我在这个网站上找到了这个例子:Stack Overflow - Simple RPC Use Case Problem (Code Included)GWT模块继承和无应用程序运行时可用的源代码

为什么我做了这个例子?因为我得到的错误与用户在我自己的项目中发布的错误相同,我决定尝试在计算机上跟踪他的代码,看看我是否可以真正面对自己的错误。

因此,问题是复制上一个Eclipse GWT项目中的文件和部署的应用程序后,我得到了这两个错误上运行时间:

[第一错误]

12:14:07.874 [ERROR] [test] Line 17: No source code is available for type com.google.gwt.user.server.rpc.RemoteServiceServlet; did you forget to inherit a required module? 

[ 2n个错误]

12:42:54.547 [ERROR] [test] Unable to find type 'org.redboffin.worldhug.client.test.Test' 

12:14:09.341 [ERROR] [test] 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 

于是,我就科尔ect Test.gwt.xml Craig在帖子中建议。不幸的是,这个解决方案对我来说并不合适,因为我仍然得到相同的错误。在这里你可以看到一个图像链接(上ImageShack的)我的Eclipse屏幕:

http://yfrog.com/n7errorgwtj

[第一错误]我不知道发生了什么,因为,例如,在文件中它被描绘,RemoteServiceServlet之前导入了一些行(尽管没有看到)。这个文件在包“org.redboffin.worldhug.server.test;”

[2n错误]如果发布初始线程的用户不需要在他的项目中“继承”一个新包,我无法理解为什么我需要它们。不管怎样,我把新的继承线之一.gwt.xml文件:

​​

这是我得到:

Loading inherited module 'org.redboffin.worldhug.client.test.Test' 
    [ERROR] Unable to find 'org/redboffin/worldhug/client/test/Test.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? 

(当然,它并没有编译)

所以,我真的不知道发生了什么。请问,有人能为这个问题带来一些启示吗?为什么这不起作用?我做得不好?这是什么类型的[第二个错误]需要它?

非常感谢所有读者到目前为止,

问候。

回答

1

想我看到它:

Test.java应该在client.test包中,而不仅仅是client,或者一切应该指向client.Test而不是client.test.Test

0

您的服务器类似乎在server.test包下,而不仅仅是服务器,可能是错误的。检查web.xml中的映射是否正确指向此类。

我怀疑真正的错误可能是其他地方,但我会期待它仍然编译。

+0

我只是看看例子,似乎路径是正确的。但是,为什么你使用SO代码而不是Google教程? – 2010-11-25 12:24:41

+0

我尝试了一些谷歌的教程,我发现他们长期,复杂和不明确的人不是高手在这种网络开发的。总而言之,我试图遵循St​​ockWatcher示例来明确自己的想法,并在遵循所有应用程序无法使用的方式之后。我感到沮丧,正在寻找像我用过的例子那样的小东西。不过我对我自己的项目面临着同样的错误,我想,如果我知道如何解决上一个小项目,这些错误也许我可以做同样的一个更大的。 – Irene 2010-11-25 13:27:52

+0

我做了stockwatcher教程,并认为它非常好。你应该在教程的每个阶段有所作为,而不仅仅是最后。 GWT确实有几个文件需要正确的设置才能发生。 – 2010-11-25 14:38:41

0

(不知道我是否有“回答你的问题”与否,首先尝试在Stack Overflow网站!)

感谢您的评论,阿德里安!

这是“web的内容。XML”文件:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE web-app 
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd"> 

<web-app> 

<!-- Servlets --> 

<servlet> 
    <servlet-name>testServlet</servlet-name> 
    <servlet-class>org.redboffin.worldhug.server.test.TestServiceImpl</servlet-class> 
</servlet> 

<servlet-mapping> 
    <servlet-name>testServlet</servlet-name> 
    <url-pattern>/worldhug/test/testService</url-pattern> 
</servlet-mapping> 

<!-- Default page to serve --> 
<welcome-file-list> 
    <welcome-file>test.html</welcome-file> 
</welcome-file-list> 
</web-app> 

看来,这个servlet标签指向正确的地方,我的眼睛:TestServiceImpl.java里面包‘org.redboffin.worldhug.server.test’你有没有?!意味着

任何其他的想法

再次谢谢:)

3

您好艾琳和其他Web-流浪汉,

也许这是一个已经回答后双岗还是让我说,这是一个试图澄清关于包括在xml文件Java源代码。我陷入了同样的困境,但我无法指出阿德里安的意思。最后两个源标签会告诉编译哪些包和尾随的源文件。这就是为什么你应该在名为“path”的属性中命名每个包。

在Eclipse靛蓝下面是自动生成的Framework版本的文件:AppEngine上的Java-SDK-1.6.4.1。它没有不必要的评论。

<?xml version="1.0" encoding="UTF-8"?> 
<module rename-to='wk_cms'> 
    <!-- Inherit the core Web Toolkit stuff. --> 
    <inherits name='com.google.gwt.user.User'/> 
    <inherits name='com.google.gwt.json.JSON'/> 
    <inherits name='com.google.gwt.http.HTTP'/> 

    <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> 

    <!-- Other module inherits --> 

    <!-- Specify the app entry point class. --> 
    <entry-point class='de.someproject.wkcms.client.Wk_cms'/> 

    <!-- Specify the paths for translatable code --> 
    <source path='client'/>   <<-- my code (package client) 
    <source path='communication'/> <<-- my code (package communication) 
</module> 

我希望这会让每个人都从远方探测和测试其成功之前... =)

最好的问候, 色嫫

PS。编辑的文件不是web.xml,而是PROJECTNAME.gwt.xml。

0

您必须包括以下

<source path='client.test'/>