HelloMVP sample in GWT 2.2M1 - error

430 views
Skip to first unread message

Hari shankar

unread,
Jan 30, 2011, 2:23:15 PM1/30/11
to google-we...@googlegroups.com
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.

Thomas Broyer

unread,
Jan 30, 2011, 6:59:23 PM1/30/11
to google-we...@googlegroups.com
Have you compiled you classes (I mean "javac", producing *.class files) and are those classes in your classpath?

har_shan

unread,
Jan 31, 2011, 12:57:29 AM1/31/11
to Google Web Toolkit
Thanks for reply Thomas.

Am in Eclipse for Java EE and I didn't compile them separately as i
believe Eclipse will take care of it automatically when i run as Web
Application.

This is what i did,

a. Had a maven project, '../target/app-name' as war output directory
(ran mvn war:war to copy all static resources from 'src/main/webapp'
directory)
b. Right click and Run/Debug the project as Web Application
c. Since it's hosted mode, it seems to generate some folders with
'.nocache.js' files in '../target/module-name/*.nocache.js'
d. It goes into Entry Point class and throws above mentioned exception
and exits.

Can you tell me where i need to look for classes to be present; in WEB-
INF/classes? If so, will check and let you know.

btw, am also not clear about the exact flow. If you 'GWT compile', it
will generate .js files to use in production, fine. But what about
hosted mode? It again seems to generate some .js files as i mentioned
above (we also seem to reference this in hosted html page). Does it
use that .js file as a start point and once you modify the client
code, does it regenerate needed stuff automatically and plumb it to
browser via the GWT browser plugin that we install, once we press F5/
refresh in browser?
If so, why we need client classes as .class files? Excuse me if this
is trivial.

Thanks again,

Thomas Broyer

unread,
Jan 31, 2011, 10:46:04 AM1/31/11
to google-we...@googlegroups.com


On Monday, January 31, 2011 6:57:29 AM UTC+1, har_shan wrote:
Thanks for reply Thomas.

Am in Eclipse for Java EE and I didn't compile them separately as i
believe Eclipse will take care of it automatically when i run as Web
Application.

This is what i did,

a. Had a maven project, '../target/app-name' as war output directory
(ran mvn war:war to copy all static resources from 'src/main/webapp'
directory)
b. Right click and Run/Debug the project as Web Application
c. Since it's hosted mode, it seems to generate some folders with
'.nocache.js' files in '../target/module-name/*.nocache.js'

It should be .../target/app-name/module-name/module-name.nocache.js
 
d. It goes into Entry Point class and throws above mentioned exception
and exits.

Can you tell me where i need to look for classes to be present; in WEB-
INF/classes? If so, will check and let you know.

The compiled classes have to be in the classpath for the DevMode (i.e. check your Eclipse launcher configuration)
 
btw, am also not clear about the exact flow. If you 'GWT compile', it
will generate .js files to use in production, fine. But what about
hosted mode? It again seems to generate some .js files as i mentioned
above (we also seem to reference this in hosted html page). Does it
use that .js file as a start point and once you modify the client
code, does it regenerate needed stuff automatically and plumb it to
browser via the GWT browser plugin that we install, once we press F5/
refresh in browser?

Yes.
 
If so, why we need client classes as .class files? Excuse me if this
is trivial.

DevMode compiles your *.java "on the fly" (so you see your changes without restarting the DevMode, just with a browser refresh); but in some cases (namely, getting Class<?> values out of annotations, such as the PlaceTokenizer classes out of the @WithTokenizers annotation) the compiled classes have to be in the classpath (and, you guess it, your changes to these annotations won't be "refreshed" without a DevMode re-start).

Reply all
Reply to author
Forward
0 new messages