missing FactoryModuleBuilder runtime error with plugin

483 views
Skip to first unread message

Erez Lirov

unread,
Jan 14, 2013, 12:16:32 PM1/14/13
to googl...@googlegroups.com
Hi!

I'm trying to add Gin to our GWT project.  I added the following to our .gwt.XML file:

    <inherits name='com.google.gwt.inject.Inject'/>
  <define-configuration-property name="gin.ginjector" is-multi-valued="false" />
    <set-configuration-property name="gin.ginjector"
       value="com.espoc.vericle.gwt.common.client.VericleGinjector" />

And we're trying to make a VericleGinjector like this in our module class:

@Override
  public void onModuleLoad() {
    VericleGinjector INSTANCE = GWT.create(VericleGinjector.class);
 //this is the entire function for testing purposes
  }

VericleGinjector.java looks like this:
@GinModules({ VericleGinModule.class })
public interface VericleGinjector extends Ginjector {
}

and VericleGinModule:
public class VericleGinModule extends AbstractGinModule {
  @Override
  protected void configure() {
  }

Everything compiles fine on the command line, except some build warnings with GwtP that we're not actually using yet...


build:
Compiling 1 source file to /home/dev/workspace/vericle/espoc_app/vericle-gwt/war/WEB-INF/classes
warning: Supported source version 'RELEASE_6' from annotation processor 'com.gwtplatform.dispatch.annotation.processor.GenDtoProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'com.gwtplatform.dispatch.annotation.processor.GenEventProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 'com.gwtplatform.dispatch.annotation.processor.GenDispatchProcessor' less than -source '1.7'
3 warnings
dispatch:
Compiling module com.espoc.vericle.gwt.dispatch.DispatchDev
   Compiling 1 permutation
      Compiling permutation 0...
   Compile of permutations succeeded
Linking into /home/dev/workspace/vericle/espoc_app/vericle-gwt/war/com.espoc.vericle.gwt.dispatch.Dispatch
   Link succeeded
   Compilation succeeded -- 16.080s

But, we get the following error trying to load the module in eclipse through the plugin:

12:15:23.027 [ERROR] [com.espoc.vericle.gwt.dispatch.Dispatch] Unable to load module entry point class com.espoc.vericle.gwt.dispatch.client.Dispatch (see associated exception for details)

java.lang.RuntimeException: Deferred binding failed for 'com.espoc.vericle.gwt.common.client.VericleGinjector' (did you forget to inherit a required module?)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
    at com.google.gwt.core.shared.GWT.create(GWT.java:57)
    at com.google.gwt.core.client.GWT.create(GWT.java:85)
    at com.espoc.vericle.gwt.dispatch.client.Dispatch.onModuleLoad(Dispatch.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: com/google/inject/assistedinject/FactoryModuleBuilder
    at com.google.gwt.inject.rebind.resolution.ResolutionModule.configure(ResolutionModule.java:28)
    at com.google.inject.PrivateModule.configure(PrivateModule.java:97)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.AbstractModule.install(AbstractModule.java:118)
    at com.google.gwt.inject.rebind.GinjectorGeneratorModule.configure(GinjectorGeneratorModule.java:67)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.spi.Elements.getElements(Elements.java:101)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:74)
    at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:657)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276)
    at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.shared.GWT.create(GWT.java:57)
    at com.google.gwt.core.client.GWT.create(GWT.java:85)
    at com.espoc.vericle.gwt.dispatch.client.Dispatch.onModuleLoad(Dispatch.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: com.google.inject.assistedinject.FactoryModuleBuilder
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at com.google.gwt.inject.rebind.resolution.ResolutionModule.configure(ResolutionModule.java:28)
    at com.google.inject.PrivateModule.configure(PrivateModule.java:97)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.AbstractModule.install(AbstractModule.java:118)
    at com.google.gwt.inject.rebind.GinjectorGeneratorModule.configure(GinjectorGeneratorModule.java:67)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.spi.Elements.getElements(Elements.java:101)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:74)
    at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:657)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276)
    at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.shared.GWT.create(GWT.java:57)
    at com.google.gwt.core.client.GWT.create(GWT.java:85)
    at com.espoc.vericle.gwt.dispatch.client.Dispatch.onModuleLoad(Dispatch.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:722)

I feel like we're missing something fairly small here, but we don't have much experience with either Guice or Gin.  Any clues?

Thanks!!
Erez

Jens

unread,
Jan 14, 2013, 1:36:03 PM1/14/13
to googl...@googlegroups.com

I'm trying to add Gin to our GWT project.  I added the following to our .gwt.XML file:

    <inherits name='com.google.gwt.inject.Inject'/>
  <define-configuration-property name="gin.ginjector" is-multi-valued="false" />
    <set-configuration-property name="gin.ginjector"
       value="com.espoc.vericle.gwt.common.client.VericleGinjector" />

Not sure why you do this? Do you have a custom generator that reads that gin.ginjector property value or have you done that to make Gin work? If its the latter then a config property is used to reference GinModules and not Ginjectors. So it would look like:

<define-configuration-property name="gin.modules" is-multi-valued="false" />
<extend-configuration-property name="gin.modules" value="com.espoc.vericle.gwt.common.client.VericleGinModule" />

You can use the <extend-configuration-property> line multiple times to add multiple modules to your property. For example you could have a Core.gwt.xml that defines the property and then other <anyname>.gwt.xml GWT modules could add their GinModule to that config property.

Finally you use it like

@GinModules(value = {}, properties = {"gin.modules"})
interface VericleGinjector extends Ginjector {
....
}

But if you don't need that property at all you can simply remove it and just reference the module by class

@GinModules({ VericleModule.class })
interface VericleGinjector extends Ginjector {
....
}

So @GinModules can take a list of classes (through value = { MyModule.class, ...} ) and/or a list of config properties (through properties = { 'prop1', .. })


 
Everything compiles fine on the command line, except some build warnings with GwtP that we're not actually using yet...

Annotation processors can be discovered automatically by javac if a jar contains a special file in its META-INF/services directory. Thats probably the case for gwt-platform and as you use Java7 but the annotation processor requests Java6 you get the warning just because you have gwt-platform on classpath and its annotation processors are executed automatically.



But, we get the following error trying to load the module in eclipse through the plugin:
...
Caused by: java.lang.NoClassDefFoundError: com/google/inject/assistedinject/FactoryModuleBuilder

Do you have all GIN dependencies (gin, guice, guice-assistedinject, aopalliance and javax.inject jars) on classpath during compilation/DevMode?


-- J.

Erez Lirov

unread,
Jan 15, 2013, 7:54:37 AM1/15/13
to googl...@googlegroups.com
That was it.  My dev mode didn't have all the jar files in it, so compilation worked, but dev mode didn't.
Also, the jars have to be in a certain order apparently.  This link helped a lot.
Reply all
Reply to author
Forward
0 new messages