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

Glassfish et Payara Java Discussion :

[débutant] Problème de déploiement d'EJB3 sous NetBeans


Sujet :

Glassfish et Payara Java

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Août 2005
    Messages
    2
    Détails du profil
    Informations personnelles :
    Âge : 47

    Informations forums :
    Inscription : Août 2005
    Messages : 2
    Points : 1
    Points
    1
    Par défaut [débutant] Problème de déploiement d'EJB3 sous NetBeans
    Bonjour,

    Je suis débutant en EJB, j'ai voulu tester l'exemple de Patrice Secheresse sur la création d'un EJB Module avec Netbeans 6 et Glassfish V2.

    Je suis aller jusqu'au bout du tutoriel (test Junit) je n'ai pas eu de pb. J'ai donc voulu essayer d'appeler cette EJB Module à partir d'un projet "Web Application" utilisant Struts. Mais là ça ce complique un peu.

    J'appelle dans une action Struts ma Bean Session Remote ( NewSession2Bean) qui est une façade et qui appelle une Bean Session Locale ( NewSessionLocal ) et lors du déploiement, Netbeans me sort cette erreur :

    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
    Deploying application in domain failed; Error loading deployment descriptors for module [T_Web_managementPrototype] -- Cannot resolve reference Unresolved Ejb-Ref demo.ejb3.calculatrice.CalculatriceFacadeBean/calculatriceBean@jndi: @null@demo.ejb3.calculatrice.CalculatriceLocal@Session@null
    Deployment error:
    The module has not been deployed.
    See the server log for details.
            at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:163)
            at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
            at sun.reflect.GeneratedMethodAccessor406.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
            at org.apache.tools.ant.Task.perform(Task.java:348)
            at org.apache.tools.ant.Target.execute(Target.java:357)
            at org.apache.tools.ant.Target.performTasks(Target.java:385)
            at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
            at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
            at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
            at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
            at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
            at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
            at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
    Caused by: The module has not been deployed.
            at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:157)
            ... 16 more
    BUILD FAILED (total time: 2 seconds)
    J'appelle ma Remote de cette façon dans mon action Struts:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
        private CalculatriceFacadeRemote lookupCalculatriceFacadeBean() {
            try {
                Context c = new InitialContext();
                return (CalculatriceFacadeRemote) c.lookup("java:comp/env/CalculatriceFacadeBean");
            } catch (NamingException ne) {
                java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, "exception caught", ne);
                throw new RuntimeException(ne);
            }
        }
    Pourtant je vois mon EJB avec les beans sous Glassfish. Quelqu'un aurait une solution ?

    Ci joint le source de mes deux Session beans:

    La session bean Remote
    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
     
    package demo.ejb3.calculatrice;
     
    import javax.ejb.EJB;
    import javax.ejb.Stateful;
     
    /**
     *
     * @author
     */
    @Stateful
    public class CalculatriceFacadeBean implements CalculatriceFacadeRemote {
     
        @EJB
        private CalculatriceLocal calculatriceBean;
        int sousTotal;
     
        public int additionner(int x) {
            sousTotal = calculatriceBean.additionner(x, sousTotal);
            return sousTotal;
        }
    }
    La session bean Locale
    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
     
    package demo.ejb3.calculatrice;
     
    import javax.ejb.Stateless;
     
    /**
     *
     * @author
     */
    @Stateless
    public class CalculatriceBean implements CalculatriceLocal {
     
        public int additionner(int x, int y) {
            return x + y;
        }
    }

    Le code de mon test JUnit dans mon EJB Modulen qui MARCHE
    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
     
        /**
         * Test of additionner method, of class CalculatriceFacadeBean.
         */
        @Test
        public void additionner() {
            System.out.println("additionner");
     
            int x = 0;
            int expResult = 0;
            InitialContext ctx;
            try {
                ctx = new InitialContext();
                Object ref = ctx.lookup(CalculatriceFacadeRemote.class.getName());
                CalculatriceFacadeRemote calc = (CalculatriceFacadeRemote) PortableRemoteObject.narrow(ref, CalculatriceFacadeRemote.class);
                // Première addition + 0 = 0
                int result = calc.additionner(x);
                assertEquals(expResult, result);
                // Deuxième + 2 = 2, le bean a en mémoire le précédent résultat qui est 0
                x = 2;
                expResult = 2;
                result = calc.additionner(x);
                // Troisième + 2 = 4, le bean a en mémoire le précédent résultat qui est 2
                expResult = 4;
                result = calc.additionner(x);
                assertEquals(expResult, result);
            } catch (NamingException ex) {
                fail(ex.getMessage());
            }
        }
    Merci d'avance pour votre aide.

  2. #2
    Membre émérite
    Avatar de alexismp
    Homme Profil pro
    Inscrit en
    Janvier 2005
    Messages
    1 503
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 1 503
    Points : 2 777
    Points
    2 777
    Par défaut
    qu'y a-t-il dans le log du serveur? GLASSFISH/domains/domain1/log/server.xml

  3. #3
    Nouveau Candidat au Club
    Inscrit en
    Août 2005
    Messages
    2
    Détails du profil
    Informations personnelles :
    Âge : 47

    Informations forums :
    Inscription : Août 2005
    Messages : 2
    Points : 1
    Points
    1
    Par défaut
    Voici le log
    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
     
    [#|2008-02-04T11:48:14.000+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.tools.deployment|_ThreadID=16;_ThreadName=Thread-32;_RequestID=25220bee-0702-4f25-8cf8-d8bb52505819;|Exception occured in J2EEC Phasejava.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref demo.ejb3.calculatrice.CalculatriceFacadeBean/calculatriceBean@jndi: @null@demo.ejb3.calculatrice.CalculatriceLocal@Session@null
    com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment descriptors for module [T_Web_managementPrototype] -- Cannot resolve reference Unresolved Ejb-Ref demo.ejb3.calculatrice.CalculatriceFacadeBean/calculatriceBean@jndi: @null@demo.ejb3.calculatrice.CalculatriceLocal@Session@null
    	at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:390)
    	at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:423)
    	at com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:157)
    	at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:179)
    	at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:191)
    	at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
    	at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:919)
    	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:279)
    	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:788)
    	at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
    	at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:223)
    Caused by: java.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref demo.ejb3.calculatrice.CalculatriceFacadeBean/calculatriceBean@jndi: @null@demo.ejb3.calculatrice.CalculatriceLocal@Session@null
    	at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:430)
    	at com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:1406)
    	at com.sun.enterprise.deployment.archivist.WebArchivist.validate(WebArchivist.java:188)
    	at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:790)
    	at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:744)
    	at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:349)
    	... 10 more
    |#]
    Pour info j'ai vu ça sur le site de Sun.

  4. #4
    Membre émérite
    Avatar de alexismp
    Homme Profil pro
    Inscrit en
    Janvier 2005
    Messages
    1 503
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 1 503
    Points : 2 777
    Points
    2 777
    Par défaut
    si le rapport de bug est pertinent, l'application est mal packagée.

Discussions similaires

  1. Pb de déploiement des EJB sous Netbeans 6.1
    Par krisnet dans le forum NetBeans
    Réponses: 3
    Dernier message: 09/07/2008, 21h53
  2. Problème avec System.out.println sous Netbeans
    Par franklin626 dans le forum NetBeans
    Réponses: 2
    Dernier message: 23/04/2008, 16h08
  3. Problèmes de déploiement de servlets sous eclipse
    Par mithrendil dans le forum Eclipse Java
    Réponses: 0
    Dernier message: 13/01/2008, 17h17
  4. Réponses: 3
    Dernier message: 24/10/2006, 14h04
  5. Réponses: 7
    Dernier message: 27/09/2005, 21h40

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