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

Java EE Discussion :

EJB [Couche Service]


Sujet :

Java EE

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Homme Profil pro
    Etudiant du Genie Logiciel
    Inscrit en
    Juillet 2011
    Messages
    397
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Etudiant du Genie Logiciel
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 397
    Par défaut EJB [Couche Service]
    Salut a tous. après avoir développé un module EJB devant être appelé via client Swing, j'ai voulu le déployer au sein du Serveur GlassFish v3 , mais il me revoit cette exception :

    Une erreur s'est produite
    Error during deployment : Com/Elect/GLEP/clients/Locator/Service (wrong name: Com/Elect/GLEP/Clients/Locator/Service)

    Au prime Abord , j'ai l'impression que l'erreur se situe au niveau de ma couche Service donc voici le code source :

    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
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
     
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    package Com.Elect.GLEP.Clients.Locator ;
     
    /**
     *
     *
     */
    import Com.Elect.GLEP.clients.Locator.ServiceLocatorException;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.logging.Logger;
     
    import Com.Elect.GLEP.Util.Constants;
     
    /**
     * This class enables Swing client to look for resources (like home, remote interfaces...).
     * It follows the singleton pattern
     */
     
    public class Service {
     
        // ======================================
        // =             Attributes             =
        // ======================================
     
        private final String cname = this.getClass().getName() ;
        private Logger logger = Logger.getLogger(Constants.LOGGER_CLIENT) ;
     
        private Context initalContext ;
        private Map<String, Object> cache ;
     
     
        // ======================================
        // =             Singleton              =
        // ======================================
     
     
        private static final Service instance = new Service();
     
        public static Service getInstance() {
            return instance;
        }
     
        private Service() throws ServiceLocatorException {
     
            try {
                initalContext = new InitialContext();
                cache = new HashMap<String, Object>();
            } catch (Exception e) {
                throw new ServiceLocatorException(e);
            }
     
        }
     
        // ======================================
        // =           Business methods         =
        // ======================================
     
        /**
         * will get the ejb Local home factory. If this ejb home factory has already been
         * clients need to cast to the type of EJBHome they desire
         *
         * @param jndiName JNDI name of the EJB that we are looking for
         * @return the EJB Home corresponding to the homeName
         * @throws ServiceLocatorException thrown if lookup problems
         */
     
        public Object getRemoteInterface(String jndiName) throws ServiceLocatorException {
     
            String methodName = "getRemoteInterface" ;
            logger.entering(cname, methodName, jndiName) ;
            Object remoteInterface = getRemoteObject(jndiName) ;
            return remoteInterface ;
        }
     
        /**
         * @param connFactoryName Name of the connection factory that we are looking for
         * @return the factory for the factory to get queue connections from
         * @throws ServiceLocatorException thrown if lookup problems
         */
     
        public ConnectionFactory getConnectionFactory(String connFactoryName) throws ServiceLocatorException {
     
            String methodName = "getConnectionFactory";
            logger.entering(cname, methodName, connFactoryName);
            ConnectionFactory factory = (ConnectionFactory) getRemoteObject(connFactoryName);
     
            return factory;
        }
     
        public Destination getDestination(String destinationName) {
            String methodName = "getDestination" ;
            logger.entering(cname, methodName, destinationName) ;
            Destination destination = (Destination) getRemoteObject(destinationName) ;
            return destination;
        }
     
     
        // ======================================
        // =            Private methods         =
        // ======================================
     
        private synchronized Object getRemoteObject(String jndiName) throws ServiceLocatorException {
            String methodName = "getObject" ;
            logger.entering(cname, methodName, jndiName) ;
     
            Object remoteObject = cache.get(jndiName);
     
            if (remoteObject == null) {
                try {
                    remoteObject = initalContext.lookup(jndiName);
                    cache.put(jndiName, remoteObject);
                } catch (Exception e) {
                    throw new ServiceLocatorException(e);
                }
            }
            return remoteObject;
        }
     
    }

    j'aimerai avoir des éclaircissements sur ce problème parce qu’il me bloque et m’empêche d'avancer

  2. #2
    Membre Expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2004
    Messages
    1 184
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

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

    Informations forums :
    Inscription : Avril 2004
    Messages : 1 184
    Par défaut
    Poste nous la trace qui doit se trouver dans les logs de ton domain GlassFish.

Discussions similaires

  1. Couche Service [EJB]
    Par bza88 dans le forum Glassfish et Payara
    Réponses: 0
    Dernier message: 10/12/2011, 20h40
  2. Réponses: 0
    Dernier message: 20/04/2011, 15h07
  3. Relation entre EJB, couche métiers, JSP et servlet
    Par infinity21 dans le forum Servlets/JSP
    Réponses: 13
    Dernier message: 05/03/2007, 23h50
  4. Réponses: 3
    Dernier message: 01/03/2007, 21h26
  5. couche service, couche présentation
    Par khallouk_soft dans le forum Spring
    Réponses: 4
    Dernier message: 13/12/2006, 12h07

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