Failed to create an instance of Service via deferred binding

后端 未结 2 916
心在旅途
心在旅途 2021-02-13 12:12

I have been trying to build a GWT / Google App Engine web app using the mvp4g framework.

I keep getting an error about Failing to create an instance of my Service

相关标签:
2条回答
  • 2021-02-13 12:45

    This can happen if anything that is in your client package has an import that is not whitelisted. For example i hit this because my autoimport imported an apache commons lang class into my client code.

    One would have to look at their imports to make sure nothing odd is in the client code.

    GWT projects are structured like:

    com.app.client com.app.server

    you can't having anything that not GWT compatible in client.

    0 讨论(0)
  • 2021-02-13 12:51

    If your service methods contains POJO's they can cause you problems, they must have a zero argument constructor or no constructor defined. Also they must implement either IsSerializable or Serializable.

    You can trie to create the service manually with:

    MainServiceAsync service = GWT.create(MainService.class);
    

    And maybe post the MainService classes.

    Edited:

    This is an output from the treelogger with a deferred binding failing, and it is outputed into the console when you do a gwt compile. You can also see this output in the devmode console if you run in hosted mode. Always check the first error, because the others are most of the time caused by the first error.

    Compiling module se.pathed.defa.DefaultGwtProject
       Scanning for additional dependencies: file:/C:/Users/Patrik/workspace/skola-workspace/DefaultGwtProject/src/se/pathed/defa/client/DefaultGwtProject.java
          Computing all possible rebind results for 'se.pathed.defa.client.GreetingService'
             Rebinding se.pathed.defa.client.GreetingService
                Invoking com.google.gwt.dev.javac.StandardGeneratorContext@16c6a55
                   Generating client proxy for remote service interface 'se.pathed.defa.client.GreetingService'
                      [ERROR] se.pathed.defa.shared.UserBean is not default instantiable (it must have a zero-argument constructor or no constructors at all) and has no custom serializer. (reached via se.pathed.defa.shared.UserBean)
                      [ERROR] se.pathed.defa.shared.UserBean has no available instantiable subtypes. (reached via se.pathed.defa.shared.UserBean)
                         [ERROR]    subtype se.pathed.defa.shared.UserBean is not default instantiable (it must have a zero-argument constructor or no constructors at all) and has no custom serializer. (reached via se.pathed.defa.shared.UserBean)
       [ERROR] Errors in 'file:/C:/Users/Patrik/workspace/skola-workspace/DefaultGwtProject/src/se/pathed/defa/client/DefaultGwtProject.java'
          [ERROR] Line 37:  Failed to resolve 'se.pathed.defa.client.GreetingService' via deferred binding
       Scanning for additional dependencies: jar:file:/C:/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/gwt-user.jar!/com/google/gwt/core/client/impl/SchedulerImpl.java
          [WARN] The following resources will not be created because they were never committed (did you forget to call commit()?)
             [WARN] C:\Users\Patrik\AppData\Local\Temp\gwtc301646733929273376.tmp\se.pathed.defa.DefaultGwtProject\compiler\se.pathed.defa.client.GreetingService.rpc.log
          [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
             [WARN] se.pathed.defa.client.GreetingService_Proxy
       [ERROR] Cannot proceed due to previous errors
    
    0 讨论(0)
提交回复
热议问题