GWT 1.7.1

13 views
Skip to first unread message

amicool

unread,
Dec 21, 2009, 10:18:49 PM12/21/09
to Google Web Toolkit
Hi,

I want to integrate the GWT in my product for some UI screens.
I have created the GWT project and extended the entry point class with
the class from my product.
Those related classes are packaged in product specific jar files.

I have given the class name in <inherits> tag in <project-
name>.gwt.xml
I have added the same in classpath through eclipse--> project-->
properties-->java build path

At eclipse, the code is compiled.
But when I have started to compile the code through GWT compiler to
generate the javascript and html, i am getting below error.

" No source code is available for type .................... did you
forget to inherit a required module?"

Does any one faced this problem?
Please share if any clue asap

Thanks in advance.

Jim Douglas

unread,
Dec 21, 2009, 10:52:32 PM12/21/09
to Google Web Toolkit
I think Jeff Chimene already answered this question for you:

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/e31771defbdb6e47/892889ab68074f08#892889ab68074f08

GWT doesn't compile arbitrary Java classes to JavaScript. You can
find the list of supported classes (and methods within those classes)
here:

http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html

For example, I just tried to add this block of code to a GWT Web App
module:

Class c = this.getClass();
String name = c.getName();
String GWT_chokes_on_this = c.getCanonicalName();

The compiler complains about Class.getCanonicalName() because it's not
a GWT-supported method (i.e. GWT does not know how to translate it to
JavaScript):

Compiling module com.acme.sample.Sample
Validating newly compiled units
[ERROR] Errors in 'file:/Users/jimdouglas/Documents/Eclipse/
Sample/src/com/acme/sample/client/Sample.java'
[ERROR] Line 47: The method getCanonicalName() is undefined
for the type Class
Finding entry point classes
[ERROR] Unable to find type 'com.acme.sample.client.Sample'
[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

If I comment out the offending line of code, the GWT compiler happily
compiles the project:

Class c = this.getClass();
String name = c.getName();
// String GWT_chokes_on_this = c.getCanonicalName();

Compiling module com.acme.sample.Sample
Compiling 6 permutations
Compiling permutation 0...
Compiling permutation 1...
Compiling permutation 2...
Compiling permutation 3...
Compiling permutation 4...
Compiling permutation 5...
Compile of permutations succeeded
Linking into /Users/jimdouglas/Documents/Eclipse/Sample/war/sample.
Link succeeded
Compilation succeeded -- 24.461s

You'll have much more success with GWT if you spend some time reading
the documentation and working through the tutorials before you try to
jump in and build a project. Also, if you're just getting started,
you'll want to start with GWT 2.0, not 1.7.1.

Jim.

amicool

unread,
Dec 21, 2009, 11:30:24 PM12/21/09
to Google Web Toolkit
Thanks Jim,

I agree with you, the information you have shared.
actually I am trying to use the third party jar which is derived from
the basic java packages within the GWT emulation limitation.

Like hibernate, we can use other jars also... right?

and while doing so I am getting the error.

I have checked below link to add the third party jar...

http://code.google.com/p/cobogw/wiki/UsingJarFile

and similarly I have added third party classes.

Please suggest, am I missing something while adding classes from third
party jar?

Regards,
amicool

On Dec 22, 8:52 am, Jim Douglas <jdoug...@basis.com> wrote:
> I think Jeff Chimene already answered this question for you:
>

> http://groups.google.com/group/google-web-toolkit/browse_thread/threa...

> > Thanks in advance.- Hide quoted text -
>
> - Show quoted text -

Jim Douglas

unread,
Dec 21, 2009, 11:54:07 PM12/21/09
to Google Web Toolkit
I think you misunderstood that page; it describes only how to add this
particular GWT module to your own GWT application:

http://code.google.com/p/cobogw/

That module was developed specifically for GWT; it's not an arbitrary
set of Java classes.

The classes that you have developed in the past for your own product
cannot be dropped directly into a GWT Web App.

Reply all
Reply to author
Forward
0 new messages