GWT 2.1.1 , HelloMVP (Google provided example illustrating Activities & Places) : Compile error. Stacktrace enclosed.

894 views
Skip to first unread message

karthik reddy

unread,
Dec 21, 2010, 1:25:26 AM12/21/10
to google-we...@googlegroups.com
I am trying to compile the HelloMVP application available at http://code.google.com/webtoolkit/doc/trunk/DevGuideMvpActivitiesAndPlaces.html . I did not make any changes to the code and just tried to compile it and was met with the following error. It basically says it cannot resolve  com.hellomvp.client.place.HelloPlace$Tokenizer. I double checked if the HelloPlace is indeed at the right location.  Would appreciate your thoughts as I am kinda stonewalled by this error.

thanks


Compiling module com.hellomvp.HelloMVP
   Resolving com.hellomvp.client.mvp.AppPlaceHistoryMapper
      Found type 'com.hellomvp.client.mvp.AppPlaceHistoryMapper'
         [ERROR] Annotation error: cannot resolve com.hellomvp.client.place.HelloPlace$Tokenizer
java.lang.ClassNotFoundException: com.hellomvp.client.place.HelloPlace$Tokenizer

        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:710)
        at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:649)
.............................
.............................

zixzigma

unread,
Dec 21, 2010, 2:33:08 AM12/21/10
to Google Web Toolkit
make sure you have this:
@WithTokenizers({HelloPlace.Tokenizer.class,
GoodbyePlace.Tokenizer.class})
public interface AppPlaceHistoryMapper extends PlaceHistoryMapper
{
}

also check the default Java Compiler for your project, make sure it is
version 1.5 or higher

Thomas Broyer

unread,
Dec 21, 2010, 5:19:38 AM12/21/10
to google-we...@googlegroups.com
Classes referenced from annotations have to be compiled for GWT to be able to process them from within generators (as is the case for @WithTokenizers on a PlaceHistoryMapper). GWT can work from *.java files only for everything else (AFAICT) but classes referenced from annotations.

So, you just have to javac all your *.java to *.class (actually, only the HellowPlace and GoodbyePlace here, but by compiling everything you're sure you don't miss anything when you add a class or change an annotation's value) and put them in the classpath for Compile.

Ferney

unread,
Dec 21, 2010, 11:08:27 AM12/21/10
to Google Web Toolkit
Sorry friends, but i don't understand GWT/MVP model.
I am a newbie and i consider GWT/MVP very dificult.

I need a good example with:
GWT/MVP, GAE, Request factory, Loggin, UIBinder,
and GWT/MVP, Request factory, loggin, UIBinder with other SQL database
(mysql or postgreSQL)

Thanks my friends...
(send or not send??? ok send...)

zixzigma

unread,
Dec 21, 2010, 2:27:45 PM12/21/10
to Google Web Toolkit
are you suggesting we need to compile our custom annotations before
compiling other classes that use them ?

is this always the case ? or only if relying on generators ?


I encountered this problem when I defined my custom annotations,
which I used in conjunction with GIN BindingAnnotation.
and sometimes at initialization, I was getting exceptions,
suggesting the Annotations cannot be found, despite them being in
classpath.
(I noticed if I mvn clean, this happens, but on second run, it was
fine)

The annotations were not doing anything special,
just as markers for GIN Binding Annotations.


I thought it was Eclipse/Maven plugin problem, when I switched to
IntelliJ, everything worked just fine.
do you think the problem I had is related to scenario you described ?



Thomas Broyer

unread,
Dec 21, 2010, 3:55:28 PM12/21/10
to google-we...@googlegroups.com


On Tuesday, December 21, 2010 8:27:45 PM UTC+1, zixzigma wrote:
are you suggesting we need to compile our custom annotations before
compiling other classes that use them ?

I mean you have to "javac" classes that are *referenced* from annotations (in this case, the PlaceTokenizer classes referenced from @WithTokenizers; that'd be true also of your service, domain object, locator or service locator with RequestFactory, unless you use @ServiceName and @ProxyForName).
Otherwise, GWT can work with only the *.java files, without the *.class.
 
is this always the case ? or only if relying on generators ?

AFAICT, only when generators read the annotations (i.e. when the PlaceHistoryMapperGenerator calls getAnnotation(WithTokenizers.class))
 
I encountered this problem when I defined my custom annotations,
which I used in conjunction with GIN BindingAnnotation.
and sometimes at initialization, I was getting exceptions,
suggesting the Annotations cannot be found, despite them being in
classpath.

GIN is a bit special, it works directly from the compiled classes, never from the *.java files (which also means it won't see your "super-source" versions of classes)

Reply all
Reply to author
Forward
0 new messages