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

Spring Java Discussion :

IoC Injection fail [Framework]


Sujet :

Spring Java

  1. #1
    Expert confirmé

    Homme Profil pro
    SDE
    Inscrit en
    Août 2007
    Messages
    2 013
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : SDE

    Informations forums :
    Inscription : Août 2007
    Messages : 2 013
    Points : 4 324
    Points
    4 324
    Par défaut IoC Injection fail
    Bonjour,

    Je travail sur un projet utilisant spring. Afin de correctement intégrer mes briques supplémentaire je tâche d'utiliser spring comme il se doit.

    Je cherche à réaliser 3 injections, et voici les détails.

    Classe :
    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
    37
    38
    39
    40
    41
    public class DocumentDAO extends GenericDAO implements IDocumentDAO {
     
        private String endPoint;
        private String login;
        private String pass;
     
        public DocumentDAO() {
            super();
        }
     
        public DocumentDAO(String endPoint, String login, String pass) {
            this.endPoint = endPoint;
            this.login = login;
            this.pass = pass;
        }
     
        public String getEndPoint() {
            return endPoint;
        }
     
        public void setEndPoint(String endPoint) {
            this.endPoint = endPoint;
        }
     
        public String getLogin() {
            return login;
        }
     
        public void setLogin(String login) {
            this.login = login;
        }
     
        public String getPass() {
            return pass;
        }
     
        public void setPass(String pass) {
            this.pass = pass;
        }
       ...
    }
    J'ai essayer :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
      <bean id="documentDAO" class="fr.cg95.cvq.dao.document.alfresco.DocumentDAO" parent="genericDAO">
        <constructor-arg index="0" type="java.lang.String" value="http://capdemat:8081/alfresco/api"/>
        <constructor-arg index="1" type="java.lang.String" value="admin"/>
        <constructor-arg index="2" type="java.lang.String" value="admin"/>
      </bean>
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
      <bean id="documentDAO" class="fr.cg95.cvq.dao.document.alfresco.DocumentDAO" parent="genericDAO">
        <property name="endPoint" value="http://capdemat:8081/alfresco/api"/>
        <property name="login" value="admin"/>
        <property name="pass" value="admin"/>
      </bean>
    Aucun d'eux ne marche oO.

    L'exception soulevée avec l'injection par constructeur est la suivante :
    2009-09-08 19:28:12.784::WARN: Failed startup of context org.mortbay.jetty.webapp.WebAppContext@175b132{/CapDemat,/home/fred/capdemat/trunk/BackOfficeNG/web-app}
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestAdaptorService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeFolderService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'localAuthorityRegistry' while setting bean property 'localAuthorityRegistry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localAuthorityRegistry' defined in URL [file:grails-app/conf/spring/applicationContext-deployment.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentTypeService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContextCheckAspect' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'documentDAO' while setting bean property 'documentDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
    at java.security.AccessController.doPrivileged(Native Method)
    at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy:68)
    at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy)
    at Init_groovy$_run_closure6.doCall(Init_groovy:128)
    at RunApp_groovy$_run_closure2.doCall(RunApp_groovy:67)
    at RunApp_groovy$_run_closure2.doCall(RunApp_groovy)
    at RunApp_groovy$_run_closure1.doCall(RunApp_groovy:59)
    at RunApp_groovy$_run_closure1.doCall(RunApp_groovy)
    at gant.Gant.dispatch(Gant.groovy:271)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.processTargets(Gant.groovy:436)
    at gant.Gant.processArgs(Gant.groovy:372)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeFolderService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'localAuthorityRegistry' while setting bean property 'localAuthorityRegistry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localAuthorityRegistry' defined in URL [file:grails-app/conf/spring/applicationContext-deployment.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentTypeService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContextCheckAspect' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'documentDAO' while setting bean property 'documentDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 13 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localAuthorityRegistry' defined in URL [file:grails-app/conf/spring/applicationContext-deployment.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentTypeService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContextCheckAspect' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'documentDAO' while setting bean property 'documentDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 14 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentTypeService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContextCheckAspect' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'documentDAO' while setting bean property 'documentDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
    at java.security.AccessController.doPrivileged(Native Method)
    at fr.cg95.cvq.service.authority.impl.LocalAuthorityRegistry.init(LocalAuthorityRegistry.java:97)
    ... 15 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContextCheckAspect' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'documentDAO' while setting bean property 'documentDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.aspectj.util.PartialOrder$SortObject.addDirectedLinks(PartialOrder.java:68)
    at org.aspectj.util.PartialOrder.addNewPartialComparable(PartialOrder.java:88)
    at org.aspectj.util.PartialOrder.sort(PartialOrder.java:121)
    ... 17 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 21 more
    2009-09-08 19:28:12.804::WARN: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestAdaptorService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeFolderService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'localAuthorityRegistry' while setting bean property 'localAuthorityRegistry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localAuthorityRegistry' defined in URL [file:grails-app/conf/spring/applicationContext-deployment.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentTypeService' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContextCheckAspect' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: Cannot resolve reference to bean 'documentDAO' while setting bean property 'documentDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities):
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO' defined in URL [file:grails-app/conf/spring/applicationContext.xml]: 3 constructor arguments specified but no matching constructor found in bean 'documentDAO' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.aspectj.util.PartialOrder$SortObject.addDirectedLinks(PartialOrder.java:68)
    at org.aspectj.util.PartialOrder.addNewPartialComparable(PartialOrder.java:88)
    at org.aspectj.util.PartialOrder.sort(PartialOrder.java:121)
    at java.security.AccessController.doPrivileged(Native Method)
    at fr.cg95.cvq.service.authority.impl.LocalAuthorityRegistry.init(LocalAuthorityRegistry.java:97)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivileged(Native Method)
    at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy:68)
    at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy)
    at Init_groovy$_run_closure6.doCall(Init_groovy:128)
    at RunApp_groovy$_run_closure2.doCall(RunApp_groovy:67)
    at RunApp_groovy$_run_closure2.doCall(RunApp_groovy)
    at RunApp_groovy$_run_closure1.doCall(RunApp_groovy:59)
    at RunApp_groovy$_run_closure1.doCall(RunApp_groovy)
    at gant.Gant.dispatch(Gant.groovy:271)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.processTargets(Gant.groovy:436)
    at gant.Gant.processArgs(Gant.groovy:372)
    Quelqu'un a une idée ?

    http://alaindefrance.wordpress.com
    Certifications : SCJP6 - SCWCD5 - SCBCD5 - SCMAD1
    SDE at BitTitan

  2. #2
    Expert éminent
    Avatar de djo.mos
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    4 666
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 4 666
    Points : 7 679
    Points
    7 679
    Par défaut
    Salut,
    Aucune raison pour que ça marche pas

    Je pencherais pour un problème de build/rafraichissement : on dirait que Spring travaille sur une ancienne version de documentDao qui ne définit pas le constructeur à 3 arguments.

  3. #3
    Expert confirmé

    Homme Profil pro
    SDE
    Inscrit en
    Août 2007
    Messages
    2 013
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : SDE

    Informations forums :
    Inscription : Août 2007
    Messages : 2 013
    Points : 4 324
    Points
    4 324
    Par défaut
    Oups, oublié de repasser par ici.

    Le problème est résolu. Après un petit coup de jad j'ai pu m'appercevoir que la construction de l'application ne s'éffectuait pas comme il le faut et qu'une vielle version des classes était présente. un bon rm a résolu le problème.
    http://alaindefrance.wordpress.com
    Certifications : SCJP6 - SCWCD5 - SCBCD5 - SCMAD1
    SDE at BitTitan

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. JBoss 4.2.3.GA: Injection failed on managed bean
    Par JacNar6 dans le forum Wildfly/JBoss
    Réponses: 25
    Dernier message: 28/10/2014, 15h49
  2. Erreur "Injection failed on managed bean"
    Par sahlyhassani007 dans le forum Java EE
    Réponses: 2
    Dernier message: 29/10/2012, 14h11
  3. Erreur "Injection of autowired dependencies failed"
    Par achref05 dans le forum Plateformes (Java EE, Jakarta EE, Spring) et Serveurs
    Réponses: 1
    Dernier message: 27/10/2011, 12h02
  4. [Web Services] [Remoting][CXF] Injection Spring IOC
    Par Ylias dans le forum Spring
    Réponses: 8
    Dernier message: 05/01/2009, 10h34
  5. Réponses: 9
    Dernier message: 06/08/2007, 01h37

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