Erreur "Failed to create an instance of 'com.diallo.chabeka.bibliotheque.client.AppliBib"
Bonjour,
alors j'ai projet GWT qui marchait bien et du cout j'ai voulu inclure l'injecteur de dépendance GIN et là j'ai une erreur que je n'arrive pas à comprendre. ça fait deux jour que je cherche sur internet mais j'arrive pas à trouver la solution.
Voici la structure de mon projet:
AppController.java
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
package com.diallo.chabeka.bibliotheque.client;
import net.customware.gwt.dispatch.client.DispatchAsync;
import com.diallo.chabeka.bibliotheque.client.widgets.myWidgetPresenter.MainWidgetPresenter;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.inject.Inject;
public class AppController {
private HasWidgets container;
MainWidgetPresenter mainWidgetPresenter;
@Inject
public AppController(DispatchAsync dispatcher,
MainWidgetPresenter mainWidgetPresenter) {
this.mainWidgetPresenter= mainWidgetPresenter;
}
private void showMain() {
container.clear();
container.add(mainWidgetPresenter.getDisplay().asWidget());
}
public void go(final HasWidgets container) {
this.container = container;
showMain();
}
} |
Mon EntryPoint:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
package com.diallo.chabeka.bibliotheque.client;
import com.diallo.chabeka.bibliotheque.client.gin.Injector;
import com.diallo.chabeka.bibliotheque.client.widgets.myWidgetPresenter.MainWidgetPresenter;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
public class AppliBibliotheque implements EntryPoint {
public void onModuleLoad() {
final Injector ginjector = GWT.create(Injector.class);
final AppController app = ginjector.getAppController();
RootPanel panel = RootPanel.get();
app.go(panel);
}
} |
injecteur de dépendances Gin
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
package com.diallo.chabeka.bibliotheque.client.gin;
import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.place.PlaceManager;
import com.diallo.chabeka.bibliotheque.client.AppController;
import com.diallo.chabeka.bibliotheque.client.widgets.myWidgetPresenter.MainWidgetPresenter;
import com.google.gwt.inject.client.GinModules;
import com.google.gwt.inject.client.Ginjector;
@GinModules(Module.class)
public interface Injector extends Ginjector {
AppController getAppController();
MainWidgetPresenter getMainWidgetPresenter();
EventBus getEventBus();
PlaceManager getPlaceManager();
} |
module configuration du binding Gin
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
ackage com.diallo.chabeka.bibliotheque.client.gin;
import net.customware.gwt.presenter.client.DefaultEventBus;
import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.gin.AbstractPresenterModule;
import net.customware.gwt.presenter.client.place.PlaceManager;
import com.diallo.chabeka.bibliotheque.client.AppController;
import com.diallo.chabeka.bibliotheque.client.presenters.AccueilPresenter;
import com.diallo.chabeka.bibliotheque.client.views.Accueil;
import com.diallo.chabeka.bibliotheque.client.widgets.MainWidget;
import com.diallo.chabeka.bibliotheque.client.widgets.myWidgetPresenter.MainWidgetPresenter;
import com.google.inject.Singleton;
public class Module extends AbstractPresenterModule {
@Override
protected void configure() { bind(EventBus.class).to(DefaultEventBus.class).in(Singleton.class);
bind(PlaceManager.class).in(Singleton.class);
bind(AppController.class).in(Singleton.class); bindPresenter(MainWidgetPresenter.class,MainWidgetPresenter.Display.class, MainWidget.class);
bindPresenter(AccueilPresenter.class,AccueilPresenter.Display.class, Accueil.class);
}
} |
fichier .gwt.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='applibibliotheque'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.gwt.inject.Inject' />
<inherits name='org.enunes.gwt.mvp.Mvp' />
<inherits name='net.customware.gwt.dispatch.Dispatch' />
<inherits name='net.customware.gwt.presenter.Presenter' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='com.diallo.chabeka.bibliotheque.client.AppliBibliotheque' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module> |
et voici mon erreur:
[ERROR] [applibibliotheque] - Failed to create an instance of 'com.diallo.chabeka.bibliotheque.client.AppliBibliotheque' via deferred binding
[ERROR] [applibibliotheque] - Unable to load module entry point class com.diallo.chabeka.bibliotheque.client.AppliBibliotheque (see associated exception for details)
[ERROR] [applibibliotheque] - Failed to load module 'applibibliotheque' from user agent 'Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0' at 127.0.0.1:54729
sur le navigateur web firefox ça m'affiche cette erreur:
EntryPoint initialization exception
Exception while loading module com.diallo.chabeka.bibliotheque.client.AppliBibliotheque. See Development Mode for details.
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries) at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:503) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Unknown Source)
L'erreur se trouve apparemment sur cette ligne qui se trouve dans mon entryPoint
Code:
final Injector ginjector = GWT.create(Injector.class);
un extrait de la console
java.lang.RuntimeException: Deferred binding failed for 'com.diallo.chabeka.bibliotheque.client.gin.Injector' (did you forget to inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at com.diallo.chabeka.bibliotheque.client.AppliBibliotheque.<init>(AppliBibliotheque.java:21)
..........
..........
Quelqu'un aurait-il une idée sur l'erreur
Merci de votre aide