Getting Started example not working?

149 views
Skip to first unread message

Jason

unread,
Aug 26, 2010, 4:29:55 AM8/26/10
to GWTP
I'm using GWT 2.1M2, which *may* have something to do with it, but the
compilation errors do not seem to be related to GWT in general. Be
forewarned, Java is not my strongest language; I'm researching this
for a project at work.


Here are the problems I'm seeing:


1. MyPlaceManager.java

@Override
public void revealDefaultPlace() {
revealPlace(new PlaceRequest(MainPagePresenter.nameToken));
}

MainPagePresenter.nameToken does not exist and it is not explained in
the Getting Started instructions what it should be. I have temporarily
replaced it with the String "main" because that is what the default
presenter nametoken is. The Getting Started page should be updated to
reflect what this should actually be.


2. After the above change, I receive a compile exception:

Compiling module com.jason.gwtp.sample.GWTPSample
Resolving com.jason.gwtp.sample.client.MyGinjector
Found type 'com.jason.gwtp.sample.client.MyGinjector'
[ERROR] Annotation error: cannot resolve
com.jason.gwtp.sample.client.MyModule
java.lang.ClassNotFoundException:
com.jason.gwtp.sample.client.MyModule
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
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:
670)
at
com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotationValue(TypeOracleMediator.java:
609)
at
com.google.gwt.dev.javac.TypeOracleMediator.createAnnotation(TypeOracleMediator.java:
400)
at
com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:
568)
at
com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:
583)
at
com.google.gwt.dev.javac.TypeOracleMediator.resolveClass(TypeOracleMediator.java:
728)
at
com.google.gwt.dev.javac.TypeOracleMediator.addNewUnits(TypeOracleMediator.java:
353)
at
com.google.gwt.dev.javac.CompilationState.assimilateUnits(CompilationState.java:
135)
at
com.google.gwt.dev.javac.CompilationState.<init>(CompilationState.java:
79)
at
com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:
311)
at
com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:
193)
at
com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:
289)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:496)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:433)
at com.google.gwt.dev.Compiler.run(Compiler.java:203)
at com.google.gwt.dev.Compiler.run(Compiler.java:173)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:145)
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:152)
[ERROR] Annotation error: expected class java.lang.Class, got
null
Scanning for additional dependencies: file:/E:/Development/
Workspace/GWTPSample/src/com/jason/gwtp/sample/client/GWTPSample.java
Computing all possible rebind results for
'com.jason.gwtp.sample.client.MyGinjector'
Rebinding com.jason.gwtp.sample.client.MyGinjector
Invoking generator
com.google.gwt.inject.rebind.GinjectorGenerator
[ERROR] Generator
'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception
while rebinding 'com.jason.gwtp.sample.client.MyGinjector'
com.google.inject.ProvisionException: Guice provision errors:

1) Error creating key for interface
com.google.gwt.inject.client.AsyncProvider<com.jason.gwtp.sample.client.MainPagePresenter>

1 error
at com.google.gwt.inject.rebind.util.KeyUtil.getKey(KeyUtil.java:151)
at com.google.gwt.inject.rebind.util.KeyUtil.getKey(KeyUtil.java:75)
at
com.google.gwt.inject.rebind.BindingsProcessor.addUnresolvedEntriesForInjectorInterface(BindingsProcessor.java:
335)
at
com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:
217)
at
com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorImpl.java:
76)
at
com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:
48)
at
com.google.gwt.dev.javac.StandardGeneratorContext.runGenerator(StandardGeneratorContext.java:
428)
at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:
38)
at com.google.gwt.dev.shell.StandardRebindOracle
$Rebinder.tryRebind(StandardRebindOracle.java:108)
at com.google.gwt.dev.shell.StandardRebindOracle
$Rebinder.rebind(StandardRebindOracle.java:54)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:
154)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:
143)
at com.google.gwt.dev.Precompile
$DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(Precompile.java:
337)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:
95)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox
$CompilerImpl.process(AbstractCompiler.java:200)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:
444)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox
$CompilerImpl.compile(AbstractCompiler.java:123)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox
$CompilerImpl.compile(AbstractCompiler.java:234)
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access
$200(AbstractCompiler.java:109)
at
com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:
522)
at
com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:
112)
at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:
47)
at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:
463)
at
com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:
32)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:515)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:433)
at com.google.gwt.dev.Compiler.run(Compiler.java:203)
at com.google.gwt.dev.Compiler.run(Compiler.java:173)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:145)
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:152)
Caused by: java.lang.ClassNotFoundException:
com.jason.gwtp.sample.client.MainPagePresenter
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.google.gwt.inject.rebind.util.KeyUtil.loadClass(KeyUtil.java:
395)
at
com.google.gwt.inject.rebind.util.KeyUtil.gwtTypeToJavaType(KeyUtil.java:
369)
at
com.google.gwt.inject.rebind.util.KeyUtil.gwtTypeToJavaType(KeyUtil.java:
351)
at com.google.gwt.inject.rebind.util.KeyUtil.getKey(KeyUtil.java:148)
... 31 more
[ERROR] Errors in 'file:/E:/Development/Workspace/GWTPSample/src/
com/jason/gwtp/sample/client/GWTPSample.java'
[ERROR] Line 11: Failed to resolve
'com.jason.gwtp.sample.client.MyGinjector' via deferred binding
Scanning for additional dependencies: jar:file:/C:/Program%20Files/
eclipse/plugins/com.google.gwt.eclipse.sdkbundle.
2.1.0_2.1.0.m2-201007091218/gwt-2.1.0.M2/gwt-user.jar!/com/google/gwt/
core/client/impl/SchedulerImpl.java
[WARN] For the following type(s), generated source was never
committed (did you forget to call commit()?)
[WARN] com.jason.gwtp.sample.client.MyGinjectorImpl
[ERROR] Cannot proceed due to previous errors



This first part of this stack trace confuses me, because
com.jason.gwtp.sample.client.MyModule *does* exist, is imported, and
has no errors.


This is where I'm stuck. Any help would be greatly appreciated!

dominic jansen

unread,
Aug 26, 2010, 5:09:44 AM8/26/10
to gwt-pl...@googlegroups.com
Hey Jason,

which example have you implemented?

Take a look here:

http://code.google.com/p/gwt-platform/source/browse/?repo=samples#hg/basicsample/src/com/gwtplatform/samples/basic/client

There you can find a working gwtp example. Maybe you get a hint :)

(Regarding to that example) Are all of your presenters declared in the
MyModule.java? In my experience errors from the MyGinjector refer to
errors in the MyModule.


Btw: Setting the nameToken to "main" makes sense, if you want the
MainPagePresenter to be your MainPage...


Best,
Dom

2010/8/26 Jason <jason.m...@gmail.com>:

Christian Goudreau

unread,
Aug 26, 2010, 7:22:45 AM8/26/10
to gwt-pl...@googlegroups.com
Yeah you're right by thinking that GWT 2.1M2 doesn't change anything :D (I use it in my own projects)

Dom clearly pointed out where should be the error, also, don't forget to write a gettor inside Ginjector file. 

For this in you MyModule:
    bindPresenter(UnAuthorizedPresenter.class,
        UnAuthorizedPresenter.MyView.class, UnAuthorizedView.class,
        UnAuthorizedPresenter.MyProxy.class);

You have to find that in your ginjector:
Provider<UnAuthorizedPresenter> getUnAuthorizedPresenter();
or that if it's an async place
AsyncProvider<UnAuthorizedPresenter> getUnAuthorizedPresenter();

Cheers,
--
Christian Goudreau
Reply all
Reply to author
Forward
0 new messages