Sunday, January 30, 2011

HelloMVP sample in GWT 2.2M1 - error

Am experimenting HelloMVP sample code given at

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

in my own project using GWT 2.2M1. (i just copy/pasted the code, with no modification)

Now am struck at following err (getting both in dev mode and compile mode, in case)

Compiling module com.app.AppHome
   Resolving com.app.client.mvp.AppPlaceHistoryMapper
      Found type 'com.app.client.mvp.AppPlaceHistoryMapper'
         [ERROR] Annotation error: cannot resolve com.app.client.place.HelloPlace$Tokenizer
java.lang.ClassNotFoundException: com.app.client.place.HelloPlace$Tokenizer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:727)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:666)
    at com.google.gwt.dev.javac.TypeOracleMediator.createAnnotation(TypeOracleMediator.java:469)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:625)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:640)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveClass(TypeOracleMediator.java:786)
    at com.google.gwt.dev.javac.TypeOracleMediator.addNewTypes(TypeOracleMediator.java:411)
    at com.google.gwt.dev.javac.TypeOracleMediatorFromSource.addNewUnits(TypeOracleMediatorFromSource.java:54)
    at com.google.gwt.dev.javac.CompilationState.assimilateUnits(CompilationState.java:165)
    at com.google.gwt.dev.javac.CompilationState.<init>(CompilationState.java:82)
    at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:392)
    at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:275)
    at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:325)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:512)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:495)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:407)
    at com.google.gwt.dev.Compiler.run(Compiler.java:215)
    at com.google.gwt.dev.Compiler.run(Compiler.java:187)
    at com.google.gwt.dev.Compiler$1.run(Compiler.java:159)
    at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
    at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
    at com.google.gwt.dev.Compiler.main(Compiler.java:166)
         [ERROR] Annotation error: expected class java.lang.Class, got null
         [ERROR] Annotation error: cannot resolve com.app.client.place.GoodbyePlace$Tokenizer
java.lang.ClassNotFoundException: com.app.client.place.GoodbyePlace$Tokenizer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:727)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:666)
    at com.google.gwt.dev.javac.TypeOracleMediator.createAnnotation(TypeOracleMediator.java:469)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:625)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:640)
    at com.google.gwt.dev.javac.TypeOracleMediator.resolveClass(TypeOracleMediator.java:786)
    at com.google.gwt.dev.javac.TypeOracleMediator.addNewTypes(TypeOracleMediator.java:411)
    at com.google.gwt.dev.javac.TypeOracleMediatorFromSource.addNewUnits(TypeOracleMediatorFromSource.java:54)
    at com.google.gwt.dev.javac.CompilationState.assimilateUnits(CompilationState.java:165)
    at com.google.gwt.dev.javac.CompilationState.<init>(CompilationState.java:82)
    at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:392)
    at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:275)
    at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:325)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:512)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:495)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:407)
    at com.google.gwt.dev.Compiler.run(Compiler.java:215)
    at com.google.gwt.dev.Compiler.run(Compiler.java:187)
    at com.google.gwt.dev.Compiler$1.run(Compiler.java:159)
    at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
    at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
    at com.google.gwt.dev.Compiler.main(Compiler.java:166)
         [ERROR] Annotation error: expected class java.lang.Class, got null
   Scanning for additional dependencies: file:/C:/STUDIES/ws/projects/App6/app-main/src/main/java/com/App/client/HelloMVP.java
      Computing all possible rebind results for 'com.app.client.mvp.AppPlaceHistoryMapper'
         Rebinding com.app.client.mvp.AppPlaceHistoryMapper
            Invoking generator com.google.gwt.place.rebind.PlaceHistoryMapperGenerator
               [ERROR] Generator 'com.google.gwt.place.rebind.PlaceHistoryMapperGenerator' threw an exception while rebinding 'com.app.client.mvp.AppPlaceHistoryMapper'
java.lang.NullPointerException
    at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.getWithTokenizerEntries(PlaceHistoryGeneratorContext.java:276)
    at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.initTokenizersWithoutGetters(PlaceHistoryGeneratorContext.java:320)
    at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.ensureInitialized(PlaceHistoryGeneratorContext.java:180)
    at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.getPlaceTypes(PlaceHistoryGeneratorContext.java:140)
    at com.google.gwt.place.rebind.PlaceHistoryMapperGenerator.writeGetPrefixAndToken(PlaceHistoryMapperGenerator.java:109)
    at com.google.gwt.place.rebind.PlaceHistoryMapperGenerator.generateOnce(PlaceHistoryMapperGenerator.java:94)
    at com.google.gwt.place.rebind.PlaceHistoryMapperGenerator.generate(PlaceHistoryMapperGenerator.java:57)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:662)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:259)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:248)
    at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
    at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:106)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:175)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:288)
    at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$400(AbstractCompiler.java:145)
    at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:632)
    at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:124)
    at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:54)
    at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:517)
    at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:35)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:541)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:495)
    at com.google.gwt.dev.Precompile.precompile(Precompile.java:407)
    at com.google.gwt.dev.Compiler.run(Compiler.java:215)
    at com.google.gwt.dev.Compiler.run(Compiler.java:187)
    at com.google.gwt.dev.Compiler$1.run(Compiler.java:159)
    at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
    at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
    at com.google.gwt.dev.Compiler.main(Compiler.java:166)
      [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
         [WARN] com.app.client.mvp.AppPlaceHistoryMapperImpl
   [ERROR] Errors in 'file:/C:/STUDIES/ws/projects/App6/app-main/src/main/java/com/App/client/HelloMVP.java'
      [ERROR] Line 43:  Failed to resolve 'com.app.client.mvp.AppPlaceHistoryMapper' via deferred binding
   [ERROR] Cannot proceed due to previous errors

-----------------------------------------------------------------------------------------------
I could understand the err a bit but couldn't find a resolution,

a. It says ClassNotFound but am sure the Tokenizer class is present (as static nested classes)
b. I debugged through GWT class PlaceHistoryGeneratorContext, as shown by

java.lang.NullPointerException
    at com.google.gwt.place.rebind.PlaceHistoryGeneratorContext.getWithTokenizerEntries(PlaceHistoryGeneratorContext.java:276)

and i see that it's not able to get the WithTokenizer annotation values, which are the tokenizer class names
This is the runtime value for 'annotation'
@com.google.gwt.place.shared.WithTokenizers(value=[null, null])
As you can see, value seems to be null, which is wrong and hence the NPE.

My question is whether am missing something trivial or is this because of some API change in new release?
Please assist. Thanks a bunch.
p.s. i haven't tried the sample in GWT 2.1 or 2.1.1; i have setup env with GPE 2.2M1 + GWT 2.2M1, so bit reluctant to switch to old and try.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment