IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

Erreur "Failed to create an instance of 'com.diallo.chabeka.bibliotheque.client.AppliBib"


Sujet :

GWT et Vaadin Java

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2008
    Messages : 22
    Par défaut 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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  2. #2
    Membre expérimenté
    Avatar de karbos
    Inscrit en
    Novembre 2008
    Messages
    155
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 155
    Par défaut
    Ton constructeur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    @Inject
    	public AppController(DispatchAsync dispatcher, 
    			             MainWidgetPresenter mainWidgetPresenter)
    Il prend des arguments que tu ne fournis pas dans la classe AppliBibliotheque. Donc ton programme pête à la ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    final AppController app = ginjector.getAppController();

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2008
    Messages : 22
    Par défaut
    D'abord getAppController() retourne directement un objet AppController dans lequel est injecté tous les modules qui dépendent. Donc getAppController() ne prend pas d'argument du coup je vois pas comment je fournirai des arguments dans la classe AppliBibliotheque déjà que ce constructeur (AppController) n'est même pas utilisé dans cette classe.

    En réalité j'ai pas compris ce que tu veux dire exactement

  4. #4
    Membre expérimenté
    Avatar de karbos
    Inscrit en
    Novembre 2008
    Messages
    155
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 155
    Par défaut
    Ben j'ai pas tout le log, mais je crois que c'est cette ligne de code qui est foireuse.
    Si elle te sert à rien, supprime là ;-)
    Sinon, il faut que tu indiques où trouver les instances de DispatchAsync et MainWidgetPresenter à injecter. J'aime pas Ginjector, mais tu devrais, par exemple, avoir deux attributs en plus dans ta classe AppControler... Quelque chose du genre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    @Inject private DispatchAsync dispatchAsync;
    @Inject private MainWidgetPresenter mainWidgetPresenter;
    Par contre, avec le code que je vois, tu vas pouvoir injecter MainWidgetPresenter, mais pas DispatchAsync...
    Bon courage !

Discussions similaires

  1. Réponses: 0
    Dernier message: 18/01/2012, 08h46
  2. [SDK 3.6.1] Erreur Failed to create the java virtual machine
    Par arsene555 dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 23/02/2011, 15h42
  3. Erreur d'installation " Failed to created process: 2! &
    Par hugobob dans le forum PostgreSQL
    Réponses: 3
    Dernier message: 19/09/2005, 12h10
  4. Réponses: 4
    Dernier message: 20/04/2005, 13h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo