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.