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

JSF Java Discussion :

Injection @EJB dans un Managed Beans


Sujet :

JSF Java

  1. #1
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut Injection @EJB dans un Managed Beans
    Bonjour,
    J'exécute une application JSF dans un conteneur Web, pour l'accès aux données j'utilises les EJB. Je rencontre un problème pour la partie cliente, lorsque j'injecte l'annotation @EJB. Je n'ai trouvé aucun tutoriel sur ce site pouvant m'aider.

    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
    42
     
    public class BackingBean {
     
        @EJB
        private IDaoClientLocal idao;
     
        private String nom = "Baron";
        private HtmlInputText composantNom;
        private HtmlCommandButton commandButton;
        private String name;
     
        public String getName() {
            return nom;
        }
        public void setName(String pName) {
            this.name = pName;
        }
        public void setComposantNom(HtmlInputText pCommand) {
            composantNom = pCommand;
        }
        public HtmlInputText getComposantNom() {
            return composantNom;
        }
        public void setcommandButton(HtmlCommandButton pCB) {
            this.commandButton = pCB;
        }
        public HtmlCommandButton getCommandButton() {
            return this.commandButton;
        }
        public void doProcess(){
             List<Client> cl = idao.getAllClients();
     
              if (commandButton != null) {
                this.commandButton.setDisabled(true);
              }
              if (composantNom != null) {
                composantNom.setValue(cl.get(0).getNom());
              }
     
        }
     
    }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <h:form>
       <h:inputText value="#{backingbean.name}" binding="#{backingbean.composantNom}" />
        <h:commandButton value="Transformer" binding="#{backingbean.commandButton}" action="#{backingbean.doProcess}" />
     </h:form>
    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
     
    Cannot resolve reference Unresolved Ejb-Ref test.beans.BackingBean/idao@jndi: @null@edtc.dao.client.IDaoClientLocal@Session@null
    Une exception s''est produite dans la phase J2EEC.java.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref test.beans.BackingBean/idao@jndi: @null@edtc.dao.client.IDaoClientLocal@Session@null
    com.sun.enterprise.deployment.backend.IASDeploymentException: Erreur lors du chargement des descripteurs du déploiement pour le module [JSFAppl] -- Cannot resolve reference Unresolved Ejb-Ref test.beans.BackingBean/idao@jndi: @null@edtc.dao.client.IDaoClientLocal@Session@null
            at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:406)
            at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:426)
            at com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:160)
            at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:182)
            at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
            at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
            at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
            at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
            at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
            at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
            at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)
    Caused by: java.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref test.beans.BackingBean/idao@jndi: @null@edtc.dao.client.IDaoClientLocal@Session@null
            at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:430)
            at com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:1415)
            at com.sun.enterprise.deployment.archivist.WebArchivist.validate(WebArchivist.java:188)
            at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:840)
            at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:794)
            at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:365)
            ... 10 more
    Personne ne m'a jamais répondu depuis 2009 sur ces forums, j'aimerais bien qu'on m'accorde une chance cette fois-ci
    Cordialement.

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    191
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2007
    Messages : 191
    Points : 118
    Points
    118
    Par défaut
    Comment as-tu déclaré ta classe IDaoClientLocal?

  3. #3
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    Je vous remercie pour votre réponse.

    Voici le code de IDaoClientLocal qui étend IDaoClient, l'interface contenant mes méthodes de la logique métier.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    @Local
    public interface IDaoClientLocal extends IDaoClient{
    }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    public interface IDaoClient {
     
         public List<Client> getAllClients();
         public int getConnexionClient(String login, String password);
         public boolean getInsertClient(String nom, String prenom, String adresse,
                String ville, String region, String pays, int codePostal,
                String telephone, String mail, String login, String password);
         public Client getAllReservationById(int idClient);
         public int getNombreReservation(int service, int idClient);
    }

  4. #4
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    Personne n'a jamais crée ce genre de clients ?

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    191
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2007
    Messages : 191
    Points : 118
    Points
    118
    Par défaut
    Tu dois plutôt avoir un truc du genre :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    @Stateless
    @Local(IDaoClient.class)
    public class IDaoClientLocal implements IDaoClient{
    }

  6. #6
    Membre éclairé Avatar de Heimdal
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    549
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 549
    Points : 718
    Points
    718
    Par défaut
    Tes EJB font partie du war?
    Quel serveur d'appli?

  7. #7
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    Bonsoir,
    Mes EJB ne sont pas dans un conteneur Web et ne peuvent pas l'être, mais dans un module EJB (conteneur d'EJB).
    J'utilise Glassfish v2.

    Voici ma classe métier :

    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
    42
    43
     
    @Stateless(mappedName="edtc.dao.client")
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public class ClientImplement implements IDaoClientLocal, IDaoClientRemote{
     
        @PersistenceContext
        private EntityManager em;
     
     
        public List<Client> getAllClients() {
     
            List<Client> cl = null;
            try {
           cl =  em.createQuery("SELECT c FROM Client c").getResultList();
     
           for (Iterator it = cl.iterator(); it.hasNext();){
             Client elem = (Client) it.next();
             elem.getIdClientCA().size();
             elem.getIdClientResto().size();
             elem.getIdClientHotel().size();
             elem.getIdClientLV().size();
             elem.getIdClientTX().size();
             elem.getIdClientAB().size();
             elem.getIdClientMessagerie().size();
             //elem.getIdClientEmissaire().size();
     
             List<ReservationlocationVoiture> rlv = elem.getIdClientLV();
                for (int i=0; i<rlv.size(); i++){
                    LocationVoiture lv = rlv.get(i).getIdLocationVoiture();
                    lv.getIdVoiture().size();
                }
              List<ArticleBlog> ab = elem.getIdClientAB();
                for (int i=0; i<ab.size(); i++){
                    ab.get(i).getCommentairesBlogList().size();
                }
             }
     
         } catch (Throwable th) {
          throw new edtcException(th, 1);
         }
            return cl;
        }
    }

  8. #8
    Membre éclairé Avatar de Heimdal
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    549
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 549
    Points : 718
    Points
    718
    Par défaut
    Tu dois donc y accéder via leur interface remote.
    Tous les arguments et retours de méthodes doivent être des objets Serializable.

    Bon chantier...

    Edit:
    Tu ne pourra pas utiliser d'injection @EJB. Il te faudra te connecter a l'annuaire JNDI de ton serveur(InitialContext avec les properties qui vont bien) et faire un lookup(TonInterfaceRemote.class.getName())

  9. #9
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    J'ai essayé avec un lookup mais cela ne marche pas n'en plus, cette méthode reste bloquante.

    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
     
     
    public void doProcess() throws RemoteException{
            try {
            Context ctx = new InitialContext();
            IDaoClientRemote idao = (IDaoClientRemote) ctx.lookup("ClientImplement/remote");
            System.out.println("ce message ne s'affiche pas, donc méthode bloquante");
             List<Client> cl = idao.getAllClients();
     
              if (commandButton != null) {
                this.commandButton.setDisabled(true);
              }
              if (composantNom != null) {
                composantNom.setValue(cl.get(0).getNom());
              }
           } catch (NamingException e) {
    // gestion des erreurs
            }
        }
    Pour @Remote, quelle est l'utilité de l'utiliser à la place de @Local ? Etant donné que mon client s'exécute dans la même JVM que celle du serveur ?

    J'ai essayé avec @Remote et il y a une nouvelle erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    javax.servlet.ServletException: javax.naming.NameNotFoundException: edtc.dao.client.IDaoClientRemote#edtc.dao.client.IDaoClientRemote not found
    Et lorsque je lis le journal, on m'écris :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    Not binding factory to JNDI, no JNDI name configured
    JNDI InitialContext properties:{}
    Initializing Sun's JavaServer Faces implementation (1.2_04-b22-p05) for context '/JSFAppl'
    Initializing Sun's JavaServer Faces implementation (1.2_04-b22-p05) for context ''
    Je ne comprends plus rien.

  10. #10
    Membre éclairé Avatar de Heimdal
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    549
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 549
    Points : 718
    Points
    718
    Par défaut
    Si tout est sur le meme serveur, pourquoi ne pas tout mettre dans un meme ear????

    Sinon je repete: lookup(TonInterfaceRemote.class.getName())... T es pas sur JBoss la.

  11. #11
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    J'utilise Glassfish.
    Sinon, pourquoi devrais-je mettre l'application dans le même ear que celui des EJB ? Cela va-t-il changer quoique ce soit ? J'ai déjà des Web services dans un conteneur Web qui fait partie de l'ear.

    J'ai retesté avec le nouveau paramètre
    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
     
     public void doProcess() throws RemoteException{
            try {
            Context ctx = new InitialContext();
            // le nom JNDI par défaut est
            // "Nom du fichier EAR/Nom de la classe du bean/type accès : local/remote"
            IDaoClientRemote idao = (IDaoClientRemote) ctx.lookup(IDaoClientRemote.class.getName());
            System.out.println("salut");
             List<Client> cl = idao.getAllClients();
     
              if (commandButton != null) {
                this.commandButton.setDisabled(true);
              }
              if (composantNom != null) {
                composantNom.setValue(cl.get(0).getNom());
              }
           } catch (NamingException e) {
             System.out.println(e);
             e.printStackTrace();
            }
        }
    Et cela affiche une erreur me disant que cette interface n'existe pas !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    javax.naming.NameNotFoundException: edtc.dao.client.IDaoClientRemote not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
            at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
            at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409)
    [..]

  12. #12
    Membre éclairé Avatar de Heimdal
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    549
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 549
    Points : 718
    Points
    718
    Par défaut
    Ta classe IDaoClientRemote est bien annoté @Remote et déjà déployé??

    Tout mettre dans le même ear, va te permettre de récupérer tes EJB via leur interface local (gain de perfs) et de faire de l'injection...

  13. #13
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    J'ai bien placé l'application Web dans l'ear et l'ai déployé, mais l'erreur persiste :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    javax.servlet.ServletException: javax.naming.NameNotFoundException: edtc.dao.client.IDaoClientRemote#edtc.dao.client.IDaoClientRemote not found
    Cause racine
     
    javax.naming.NameNotFoundException: edtc.dao.client.IDaoClientRemote#edtc.dao.client.IDaoClientRemote not found
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    @Remote
    public interface IDaoClientRemote extends IDaoClient{
    }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    public interface IDaoClient{
     
         public List<Client> getAllClients();
     
         // CLIENT
         public int getConnexionClient(String login, String password);
         public boolean getInsertClient(String nom, String prenom, String adresse,
                String ville, String region, String pays, int codePostal,
                String telephone, String mail, String login, String password);
         public Client getAllReservationById(int idClient);
         public int getNombreReservation(int service, int idClient);
    }
    Je ne comprends pas pourquoi n'arrive-t-il toujours pas à détecter cette interface alors que je l'ai ajouté à sa librairie.

  14. #14
    Membre éclairé Avatar de Heimdal
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    549
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 549
    Points : 718
    Points
    718
    Par défaut
    Si tout est dans me même ear, utilises l'injection de l'interface Local.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
     
    public class MonManagedBean {
     
    @EJB
    MonEjbLocal monEjbLocal;
     
    }
    Si ca ne marche pas, y a toujours la solution lourde:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    @EJB(name = "unNomAlaCon", beanInterface = MonEjbLocal.class)
    public class MonManagedBean {
     
    MonEjbLocal monEjbLocal = (MonEjbLocal) new InitialContext().lookup("java:comp/env/unNomAlaCon");
     
    }

  15. #15
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    Bonsoir,
    J'ai essayé avec Local, l'application veut même pas se compiler, voilà ce que ça dit :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Caused by: java.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref name@jndi: @null@edtc.dao.client.IDaoClientLocal@Session@null
    J'ai donc essayé avec Remote, ça se compile mais toujours la même exception :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    javax.naming.NameNotFoundException: edtc.dao.client.IDaoClientRemote#edtc.dao.client.IDaoClientRemote not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
            at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
    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
     
     
    @EJB(name = "name", beanInterface = IDaoClientRemote.class)
    public class BackingBean {
     
        // [..]
        public void doProcess() throws RemoteException, NamingException{
            try {
            Context ctx = new InitialContext();
     
             IDaoClientRemote dao = (IDaoClientRemote) new InitialContext().lookup("java:comp/env/name");
             List<Client> cl = dao.getAllClients();
     
              if (commandButton != null) {
                this.commandButton.setDisabled(true);
              }
              if (composantNom != null) {
                composantNom.setValue(cl.get(0).getNom());
              }
           } catch (NamingException e) {
             e.printStackTrace();
            }
        }
     
    }

  16. #16
    Membre éclairé Avatar de Heimdal
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    549
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 549
    Points : 718
    Points
    718
    Par défaut
    Fais voir ton application.xml, j'ai comme l'impression que tes EJB ne sont pas chargés...
    Lors du déploiement, y a des logs du genre de celle qu'il y a en dessous?

    [#|2010-04-30T19:18:42.667+0200|INFO|sun-appserver2.1|javax.enterprise.system.container.ejb|_ThreadID=22;_ThreadName=httpWorkerThread-5050-2;|**RemoteBusinessJndiName...etc...

  17. #17
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    Je me suis concentré pendant 5 minutes avec un article trouvé par hasard sur le Web et la solution est là :

    IDaoClientRemote dao = (IDaoClientRemote) new InitialContext().lookup("edtc.dao.client#edtc.dao.client.IDaoClientRemote");
    List<Client> cl = dao.getAllClients();

    Pour ceux à qui cela pourrait aider, voici le lien : Injection @EJB

    Un grand merci à Heimdal qui m'a soutenu pendant cette période de soucis

  18. #18
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2007
    Messages
    165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2007
    Messages : 165
    Points : 119
    Points
    119
    Par défaut
    PS : Compatible qu'avec Glassfish apparemment et non portable

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

Discussions similaires

  1. Erreur d'injection de l'EJB dans le Managed Bean
    Par bruneltouopi dans le forum Java EE
    Réponses: 18
    Dernier message: 04/01/2014, 16h44
  2. [Framework] Injection de Service spring dans un managed bean JSF
    Par _skip dans le forum Spring
    Réponses: 10
    Dernier message: 12/03/2009, 09h28
  3. injection EJB dans un validateur JSF
    Par drim dans le forum Seam
    Réponses: 3
    Dernier message: 09/01/2008, 17h13
  4. [EJB3] Injection @EJB dans le Client Web ne fonctionne pas
    Par warwink dans le forum Java EE
    Réponses: 9
    Dernier message: 04/12/2007, 00h28
  5. Réponses: 3
    Dernier message: 15/09/2006, 14h01

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