0

I am starting to use GWT for a class project and wanted to know real use cases for RPC. So, I found this example on this same website: Stack Overflow - Simple RPC Use Case Problem (Code Included)

Why I did this example? because I was getting the same errors that the user posted on my own project and I decided to try and follow his code on my computer to see if I could really face my own mistakes.

So the point is that after copying the files on an Eclipse GWT project and deploy the app, I got this two errors on running time:

1st Error

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?

2nd Error

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

So I tried to correct Test.gwt.xml as Craig suggested on the post. Unfortunately, that solution is not working to me because still I am getting the same errors.

1st error: I don't know what is happening because, for example, in the file it is depicted, RemoteServiceServlet is imported some rows before (despite it is not seen). This file is on package "org.redboffin.worldhug.server.test;"

2nd error: If user who posted initial thread did not need to "inherit" a new package in his project, I can't understand why do I need them. Anyway, I put a new inherit line one the .gwt.xml file:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.0/distro-source/core/src/gwt-module.dtd">
    <module rename-to='test'>
    <inherits name="com.google.gwt.user.User" />
    <entry-point class="org.redboffin.worldhug.client.test.Test"></entry-point>
<source path="client" />
    <source path="shared" />
    <inherits name="org.redboffin.worldhug.client.test.Test" />
    </module>

And that is what I got:

 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?

(of course, it didn't compile)

So, I really don't know what is going on. Please, can someone bring some light to this issue? Why is this not working? What I am doing bad? What is this type that it is needed on the 2nd error?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Irene
  • 579
  • 2
  • 10
  • 19

5 Answers5

3

Hello Irene and other Web-Wanderers,

Maybe this is a double post on a already answered post or let me say it is a try to clarify about includes of Java Source code in the xml file. I got stuck at the same point, but I couldn't point out what Adrian meant. The last two source tags will tell what packages and trailed source files shall be compiled. That is why you should name each package in the attribute called "path".

The file below was auto-generated in Eclipse Indigo in Framework version: appengine-java-sdk-1.6.4.1. It is bereft of unnecessary comments.

<?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>

I hope this keeps everyone afar from probing and testing before having success... =)

Best regards, Semo

PS. The file edited was not web.xml but PROJECTNAME.gwt.xml.

Semo
  • 783
  • 2
  • 17
  • 38
1

Think I see it:

Test.java should be in the client.test package not just client, or everything should point to client.Test rather than client.test.Test.

Adrian Mouat
  • 44,585
  • 16
  • 110
  • 102
0

You will have to include the following

<source path='client.test'/>
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Purushothaman
  • 417
  • 4
  • 6
0

Your server class seems to be under the package server.test, rather than just server, which is probably wrong. Check the mapping in web.xml correctly points to this class.

I suspect the real error is probably somewhere else though - I would have expected it still to compile.

Adrian Mouat
  • 44,585
  • 16
  • 110
  • 102
  • I just had a look at the example and it seems the paths are correct. But why are you using code from SO rather than the Google tutorial? – Adrian Mouat Nov 25 '10 at 12:24
  • I tried some Google tutorials and I found them long, complex and not clear to someone not expert in this kind of web developing. In sum, I tried to follow StockWatcher example to make my mind clear and after following everything the app did not work. I felt frustrated and was searching for something small like in the example I used. Nevertheless I am facing same errors on my own project, I thought that if I knew how to fix these errors on a small project maybe I could do the same on a bigger one. – Irene Nov 25 '10 at 13:27
  • I did the stockwatcher tutorial and thought it was quite good. You should have something working at each stage of the tutorial rather than just at the end. GWT does have several files that need to have the correct settings for anything to happen though. – Adrian Mouat Nov 25 '10 at 14:38
  • Yes, I had everything working except the last part, where it is supposed to see random values produced for every item in the list. :S Problem with GWT is that sometimes is confusing to have all that settings dancing at same time and put them in a correct way. – Irene Nov 26 '10 at 16:45
0

(Not sure if I have to "answer your question" or not, first try on Stack Overflow site!)

Thanks for your comment, Adrian!

This is the content of "web.xml" file:

<?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>

It seems that the servlet tag is pointing to the right place to my eyes: TestServiceImpl.java is inside package "org.redboffin.worldhug.server.test" Did you mean that?

Any other idea?

Thank you again! :)

Irene
  • 579
  • 2
  • 10
  • 19
  • Yes, that's what I meant, and yes it looks ok. However, looking at the second error, I would suggest that Test.java is in the wrong package (or it's looking for it in the wrong package). – Adrian Mouat Nov 25 '10 at 14:47