Injection issue using Resource Delegates client side (gwtp 1.4)

322 views
Skip to first unread message

Casey Jordan

unread,
Mar 28, 2015, 3:52:14 PM3/28/15
to gwt-pl...@googlegroups.com
So I have Resource Delegates working pretty well server side, but when I try and use them in my client side code I get gin injection errors.

The relevant error is here:

com.jorsek.apps.mapeditor.client.MapEditorWorkspacePresenter$Factory [com.jorsek.apps.mapeditor.client.gin.MapEditorClientModule.configure(MapEditorClientModule.java:46)]
[INFO]  -> com.gwtplatform.dispatch.rest.delegates.client.ResourceDelegate<com.jorsek.api.shared.rest.FilesResource> [member injection of com.jorsek.apps.mapeditor.client.MapEditorWorkspacePresenter#filesDelegate]

I have added the module to my gwt.xml file as per the documentation, and I am injecting into my presenter:

@Inject
ResourceDelegate<FilesResource> filesDelegate;
The only thing I can think of is that looking at the com.gwtplatform.dispatch.rest.delegates.rebindDelegateModule I don't see ResourceDelegate specifically bound anywhere, but perhaps this is something that happens in the code generation that I am not seeing. 

Any pointers would be much appreciated. 

Thanks!



--
--
Casey Jordan
easyDITA a product of Jorsek LLC
"CaseyDJordan" on LinkedIn, Twitter & Facebook
(585) 348 7399
easydita.com


This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law.  If you are not the intended recipient,
please be advised that any disclosure  copying, distribution, or use of
the information contained herein is prohibited.  If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

Christopher Viel

unread,
Mar 30, 2015, 10:51:07 AM3/30/15
to gwt-pl...@googlegroups.com
The stack trace you pasted only says that gin injected the ResourceDelegate in the filesDelegate field. Can you provide more of your stacktrace?

Thanks

--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Casey Jordan

unread,
Mar 31, 2015, 2:16:45 PM3/31/15
to gwt-pl...@googlegroups.com
Thanks for the response Chris. Here is everything that is output. This error goes away when I comment out the injection for the resource delegate.

Loading module: ezdappserver
  User agent: FF
  Remote host: localhost:59944
  Tab key: 0x16782e820
  Session key: tDF)cAiO<#bv)9@6
INFO: Ignored 10 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
DEBUG: Linking module 'ezdappserver'
  TRACE: Invoking Linker Verify the availability of a more recent version of GWTP.
    DEBUG: Checking version information for gwtp-mvp-client
      INFO: You are using the latest version of gwtp-mvp-client!
    DEBUG: Checking version information for gwtp-dispatch-rpc-client
      INFO: You are using the latest version of gwtp-dispatch-rpc-client!
    DEBUG: Checking version information for gwtp-dispatch-rest
      INFO: You are using the latest version of gwtp-dispatch-rest!
DEBUG: Rebinding com.gwtplatform.mvp.client.DesktopGinjector
  DEBUG: Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
    ERROR: Error injecting com.jorsek.apps.mapeditor.client.MapEditorWorkspaceView$Binder: Unable to create or inherit binding: No @Inject or default constructor found for com.jorsek.apps.mapeditor.client.MapEditorWorkspaceView$Binder
  Path to required node:

com.jorsek.apps.mapeditor.client.MapEditorWorkspacePresenter$MyView [com.jorsek.apps.mapeditor.client.gin.MapEditorClientModule.configure(MapEditorClientModule.java:80)]
 -> com.jorsek.apps.mapeditor.client.MapEditorWorkspaceView [com.jorsek.apps.mapeditor.client.gin.MapEditorClientModule.configure(MapEditorClientModule.java:80)]
 -> com.jorsek.apps.mapeditor.client.MapEditorWorkspaceView$Binder [@Inject constructor of com.jorsek.apps.mapeditor.client.MapEditorWorkspaceView]

    ERROR: Error injecting com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandalonePresenter$MyProxy: Unable to create or inherit binding: No @Inject or default constructor found for com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandalonePresenter$MyProxy
  Path to required node:

com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandalonePresenter$MyProxy [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:121)]

    ERROR: Error injecting com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandaloneView$MapEditorWorkspaceStandaloneViewUiBinder: Unable to create or inherit binding: No @Inject or default constructor found for com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandaloneView$MapEditorWorkspaceStandaloneViewUiBinder
  Path to required node:

com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandaloneView [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:120)]
 -> com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandaloneView$MapEditorWorkspaceStandaloneViewUiBinder [@Inject constructor of com.jorsek.apps.mapeditor.client.MapEditorWorkspaceStandaloneView]

    ERROR: Error injecting com.jorsek.apps.mapeditor.client.MapEditorApprovalAltPresenter$MyProxy: Unable to create or inherit binding: No @Inject or default constructor found for com.jorsek.apps.mapeditor.client.MapEditorApprovalAltPresenter$MyProxy
  Path to required node:

com.jorsek.apps.mapeditor.client.MapEditorApprovalAltPresenter$MyProxy [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:121)]

    ERROR: Error injecting com.jorsek.apps.mapeditor.client.MapEditorApprovalAltView$MapEditorApprovalAltViewUiBinder: Unable to create or inherit binding: No @Inject or default constructor found for com.jorsek.apps.mapeditor.client.MapEditorApprovalAltView$MapEditorApprovalAltViewUiBinder
  Path to required node:

com.jorsek.apps.mapeditor.client.MapEditorApprovalAltView [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:120)]
 -> com.jorsek.apps.mapeditor.client.MapEditorApprovalAltView$MapEditorApprovalAltViewUiBinder [@Inject constructor of com.jorsek.apps.mapeditor.client.MapEditorApprovalAltView]

    ERROR: Error injecting com.gwtplatform.dispatch.rest.delegates.client.ResourceDelegate<com.jorsek.api.shared.rest.FilesResource>: Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.dispatch.rest.delegates.client.ResourceDelegate<com.jorsek.api.shared.rest.FilesResource>
  Path to required node:

com.jorsek.apps.mapeditor.client.MapEditorWorkspacePresenter$Factory [com.jorsek.apps.mapeditor.client.gin.MapEditorClientModule.configure(MapEditorClientModule.java:46)]
 -> com.gwtplatform.dispatch.rest.delegates.client.ResourceDelegate<com.jorsek.api.shared.rest.FilesResource> [member injection of com.jorsek.apps.mapeditor.client.MapEditorWorkspacePresenter#filesDelegate]

ERROR: Deferred binding failed for 'com.gwtplatform.mvp.client.DesktopGinjector'; expect subsequent failures
ERROR: Unable to load module entry point class com.gwtplatform.mvp.client.ApplicationControllerImpl (see associated exception for details)
java.lang.RuntimeException: Deferred binding failed for 'com.gwtplatform.mvp.client.DesktopGinjector' (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.createImpl(GWT.java:83)
at com.google.gwt.core.client.GWT.create(GWT.java:86)
at com.gwtplatform.mvp.client.DesktopGinjectorProvider.get(DesktopGinjectorProvider.java:8)
at com.gwtplatform.mvp.client.ClientGinjector.<clinit>(ClientGinjector.java:12)
at com.gwtplatform.mvp.client.ApplicationControllerImpl.init(ApplicationControllerImpl.java:9)
at com.gwtplatform.mvp.client.ApplicationControllerImpl.onModuleLoad(ApplicationControllerImpl.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:423)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:530)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.inject.rebind.ErrorManager.checkForError(ErrorManager.java:59)
at com.google.gwt.inject.rebind.GinjectorBindings.resolveBindings(GinjectorBindings.java:239)
at com.google.gwt.inject.rebind.BindingsProcessor.resolveAllUnresolvedBindings(BindingsProcessor.java:146)
at com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:105)
at com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorImpl.java:79)
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:760)
at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:160)
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:152)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:613)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:483)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.shared.GWT.createImpl(GWT.java:83)
at com.google.gwt.core.client.GWT.create(GWT.java:86)
at com.gwtplatform.mvp.client.DesktopGinjectorProvider.get(DesktopGinjectorProvider.java:8)
at com.gwtplatform.mvp.client.ClientGinjector.<clinit>(ClientGinjector.java:12)
at com.gwtplatform.mvp.client.ApplicationControllerImpl.init(ApplicationControllerImpl.java:9)
at com.gwtplatform.mvp.client.ApplicationControllerImpl.onModuleLoad(ApplicationControllerImpl.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:423)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:530)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
at java.lang.Thread.run(Thread.java:745)
ERROR: Failed to load module 'ezdappserver' from user agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0' at localhost:59944

To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Christopher Viel

unread,
Apr 1, 2015, 9:05:26 PM4/1/15
to gwt-pl...@googlegroups.com
Thanks for the stack trace. I have a couple more questions though:
- Do you have any issues with Rest-Dispatch alone (without the resource delegates)?
- Also double check that the ResourceDelegate inherit is after the DispatchRest inherit in your .gwt.xml.
- If it is the case, run the gwt compiler with the following argument: "-gen target/gwt-generated". After the compilation is done, verify that "target/gwt-generated/com/gwtplatform/dispatch/rest/client/RestGinModule.java" exists. Does it contain a binding similar to this?
bind(new TypeLiteral<ResourceDelegate<com.jorsek.api.shared.rest.FilesResource>>() {})
.to(FilesResourceDelegate.class)
.in(Singleton.class);


Casey Jordan

unread,
Apr 1, 2015, 9:15:41 PM4/1/15
to gwt-pl...@googlegroups.com
Hey Chris,

Thanks. I just dug into this more and I found out that that it was becuase one of the classes that my rest resource was using was not serializable and that was causing the code generation to fail.

When this happens, do you know if there is a way to actually get a reasonable error describing this. It seems to me that the system should say something more like:

"XXX class failed to meet the serialization requirements"

That would have saved me about 3 days :)



Christopher Viel

unread,
Apr 1, 2015, 9:51:59 PM4/1/15
to gwt-pl...@googlegroups.com
Not that I know of. You can raise the logging levels to debug/trace/spam, but then you get so many logs that finding anything relevant is a pain. This is an issue we too would like to resolve. My feeling is that it would need some work in GWT and/or Gin.
Reply all
Reply to author
Forward
0 new messages