Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with simple gwt app

 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just started with GWT and i have been reading Book on GWT by prakash chaganti. While trying the PrimesService Example my self i faced some issues. Here are the file structure and the Code

File Structure
src/packtpub/gwtbook/samples/Samples.gwt.xml //Module Configuration


src/packtpub/gwtbook/samples/client
src/packtpub/gwtbook/samples/client/PrimesService.java //Service Interface
src/packtpub/gwtbook/samples/client/PrimesServiceAsync.java //Async Service Interface
src/packtpub/gwtbook/samples/client/PrimesClient.java //Entry Point Class

src/packtpub/gwtbook/samples/public
src/packtpub/gwtbook/samples/public/Samples.html //Host Page


src/packtpub/gwtbook/samples/server
src/packtpub/gwtbook/samples/server/PrimesServiceImpl.java //Service Implementation


Given below are the relevant files

Samples.gwt.xml



PrimesServiceImpl.java



PrimesClient.java



Samples.html



When i run this application in hosted mode i get following alert message

Failed to load module 'com.packtpub.gwtbook.samples.Samples'

here is the Error Log



where is the problem?
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raghav,
Please go easy on the colors and bold.

The error is being generated because of the annotations. You got two options.
1) Either comment out all @Override and other annotations
2) Or Upgrade to the latest version of GWT
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response Maneesh, I removed the annotations and then i think the real problem comes to the surface. Now i have a new error stack here it is

[DEBUG] Rebinding com.packtpub.gwtbook.samples.client.PrimesService
[DEBUG] Assimilating generated source
[ERROR] Errors in 'transient source for com.packtpub.gwtbook.samples.client.PrimesService_Proxy'
[ERROR] Line 26: The return type is incompatible with PrimesServiceAsync.isPrime(int, AsyncCallback)
[ERROR] Compilation problem due to 'transient source for com.packtpub.gwtbook.samples.client.PrimesService_Proxy'; see snapshot C:\Users\hp\AppData\Local\Temp\gen2332534200013751255.java
[ERROR] Unable to find recently-generated type 'com.packtpub.gwtbook.samples.client.PrimesService_Proxy
[ERROR] Deferred binding failed for 'com.packtpub.gwtbook.samples.client.PrimesService'; expect subsequent failures
[ERROR] Unable to load module entry point class com.packtpub.gwtbook.samples.client.PrimesClient
java.lang.RuntimeException: Deferred binding failed for 'com.packtpub.gwtbook.samples.client.PrimesService' (did you forget to inherit a required module?)
at com.google.gwt.dev.shell.JavaScriptHost.rebindAndCreate(JavaScriptHost.java:162)
at com.google.gwt.dev.shell.ShellGWT.create(ShellGWT.java:24)
at com.google.gwt.core.client.GWT.create(transient source for com.google.gwt.core.client.GWT:20)
at com.packtpub.gwtbook.samples.client.PrimesClient.onModuleLoad(PrimesClient.java:20)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:138)
at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:313)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$100(BrowserWidgetIE6.java:34)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:61)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:106)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:274)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:241)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:171)
at com.google.gwt.dev.shell.JavaScriptHost.rebindAndCreate(JavaScriptHost.java:157)
at com.google.gwt.dev.shell.ShellGWT.create(ShellGWT.java:24)
at com.google.gwt.core.client.GWT.create(transient source for com.google.gwt.core.client.GWT:20)
at com.packtpub.gwtbook.samples.client.PrimesClient.onModuleLoad(PrimesClient.java:20)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:138)
at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:313)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$100(BrowserWidgetIE6.java:34)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:61)
[ERROR] Failure to load module 'com.packtpub.gwtbook.samples.Samples'

Why is it saying Failure to load module ? where exactly is teh problem the code is very simple and its just a Test Code.
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[ERROR] Line 26: The return type is incompatible with PrimesServiceAsync.isPrime(int, AsyncCallback)

Whats the method signature in your PrimesService and PrimesServiceAsync ?


Would primeNumber.getText() evaluate to an int?
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would primeNumber.getText() evaluate to an int?


primeNumber.getText() does not need to eveluate to int i.e. why i have a parseInt method to convert the value. variable primeNumber is of type TextBox as you can see in the PrimesClient class on line number 17. primeNumber.getText() would return me the text value entered in the TextBox that will be parsed to int using wrapper class method parseInt.


primesService.isPrime(Integer.parseInt(primeNumber.getText()), callback);
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right. My bad.

Please post the method signatures for the PrimeService and PrimeServiceAsync
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is resolved. My Async Service interface method was returning an int although it should have returned void.

Thanks for indicating the problem area,

God Bless

OMSAIRAM
Raghav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic