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

JOnAS Java Discussion :

Mes applications me génèrent toutes la même erreur


Sujet :

JOnAS Java

  1. #1
    Membre du Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2007
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2007
    Messages : 84
    Points : 53
    Points
    53
    Par défaut Mes applications me génèrent toutes la même erreur
    Bonsoir tout le monde.

    Voilà, dans le cadre de mes cours, je suis amené à programmer
    des applications EJB avec Jonas.

    Au début tout fonctionnait parfaitement et la aujourd'hui plus rien de marche.
    J'ai plusieurs projet et tous me donnent la même erreur.

    Je vous joins le code d'un projet bateau qui s'appel HelloEJB.

    Alors voici l'erreur :

    javax.naming.NamingException: javax.naming.NameNotFoundException: helloHome
    Caused by: javax.naming.NameNotFoundException: helloHome
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
    at javax.naming.InitialContext.lookup(InitialContext.java:396)
    at org.objectweb.carol.jndi.spi.JRMPContext.lookup(JRMPContext.java:161)
    at org.objectweb.carol.jndi.spi.JRMPContext.lookup(JRMPContext.java:165)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.objectweb.carol.jndi.spi.ContextWrapper.lookup(ContextWrapper.java:112)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at hw.helloClient.main(helloClient.java:33)

    <End of Cause>
    at org.objectweb.carol.jndi.spi.ContextWrapper.lookup(ContextWrapper.java:122)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at hw.helloClient.main(helloClient.java:33)

    Et voici le code de mes fichiers :

    hello.java :
    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
     
    // hello.java
     
    package hw;
     
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
     
    /**
     * hello remote interface
     */
    public interface hello extends EJBObject
    {
    //    public void method1() throws RemoteException;
    //    public void method2(java.lang.String s) throws RemoteException;
    	public String sayHello() throws RemoteException;
    }

    helloClient.java :

    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
     
    // helloClient.java
    // mini Client for accessing bean hello
     
    package hw;
     
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
     
    /**
     *
     */
    public class helloClient {
     
        static Context ctx = null; 
        static helloHome home = null;
     
        public static void main(String[] arg) {
     
    	// Get InitialContext
    	try {
    	    ctx = getInitialContext();
    	} catch (NamingException e) {
    	    e.printStackTrace();
    	    System.exit(2);
    	}
     
    	// Lookup bean home 
    	String bName = "helloHome";
    	try {
    	    home = (helloHome) PortableRemoteObject.narrow(ctx.lookup(bName), helloHome.class);
    	    hello bean = home.create();
    	    System.out.println(bean.sayHello());
    	} catch(Exception e) {
    	    e.printStackTrace();
    	    System.exit(2);
    	}
     
    	// ...
        }
     
        	/**
             * Using a Properties object will work on JDK 1.1.x and Java2
             * clients
             */
    	static private Context getInitialContext() throws NamingException {
          String url = "rmi://localhost:1099";
     
    	  try {
    		// Get an InitialContext
    		Properties h = new Properties();
    		h.put(Context.INITIAL_CONTEXT_FACTORY,
    		  "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
    		h.put(Context.PROVIDER_URL, url);
    		return new InitialContext(h);
    	  } catch (NamingException ne) {
    	  	ne.printStackTrace();
    		throw ne;
    	  }
    	}
    }

    helloEJB.java :

    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
     
    // helloEJB.java
    // Stateless Session bean
     
    package hw;
     
    import javax.ejb.CreateException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
     
     
    /**
     *
     */
    public class helloEJB implements SessionBean {
     
        SessionContext ejbContext;
     
        // ------------------------------------------------------------------
        // SessionBean implementation
        // ------------------------------------------------------------------
     
     
        public void setSessionContext(SessionContext ctx) {
            ejbContext = ctx;
        }
     
     
        public void ejbRemove() {
        }
     
     
        public void ejbCreate() throws CreateException {
        }
     
        public void ejbPassivate() {
        }
     
        public void ejbActivate() {
        }
     
        // ------------------------------------------------------------------
        // hello implementation
        // ------------------------------------------------------------------
     
    //    /**
    //     * method1
    //     */
    //    public void method1() {
    //    }
    //
    //    /**
    //     * method2
    //     */
    //    public void method2(java.lang.String s) {
    //    }
     
        //  ------------------------------------------------------------------
        // hello implementation
        // -------------------------------------------------------------------
     
        public String sayHello()
        {
          return "Envoi de texte depuis l'EJB";
        }
    }

    helloHome.java :

    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
     
    // helloHome.java
     
    package hw;
     
    import java.rmi.RemoteException;
     
    import javax.ejb.CreateException;
    import javax.ejb.EJBHome;
     
    /**
     * Home interface for the bean hello
     */
    public interface helloHome extends EJBHome {
        hello create() throws CreateException, RemoteException;
    }
    Voilà si quelque passe par la et peut partager son savoir je suis preneur.
    Merci d'avance.

    Bien amicalement BOOBS60.

  2. #2
    Membre éprouvé
    Profil pro
    Inscrit en
    Février 2010
    Messages
    765
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 765
    Points : 1 036
    Points
    1 036
    Par défaut
    Comme tout s'est mis à marcher en travers tout d'un coup, quelqu'un n'aurait-il pas changé l'adresse de l'annuaire jndi par hasard ? Ou tout simplement le port ?

  3. #3
    Membre VIP Avatar de kalysto
    Profil pro
    Développeur
    Inscrit en
    Mars 2003
    Messages
    442
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur

    Informations forums :
    Inscription : Mars 2003
    Messages : 442
    Points : 568
    Points
    568
    Par défaut
    Moi je vois 2 erreurs possibles:
    • La partie serveur (ton EJB) n'est pas déployée, donc l'EJB n'est pas disponible dans le registre JNDI
    • Tu n'est pas connecté sur le bon registre JNDI (aurais tu plusieurs instances de JOnAS ?)

  4. #4
    Membre du Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2007
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2007
    Messages : 84
    Points : 53
    Points
    53
    Par défaut
    bonjour et merci de vos réponse.

    Bon apparement j'avais un soucis avec JNDI. Du coup j'ai filé mon pc à ma prof et elle à cherché à résoudre le problème.

    Quand elle me l'a rendu le problème était résolu pour la simple et bonne raison qu'elle a tout supprimé et tout réinstallé

    Du coup si le problème reviens et bien je ne saurais pas comment le résoudre.

    Mais bon maintenant tout fonctionne bien.

    Amicalement Boobs60

Discussions similaires

  1. Mes applications framework.net quittent tout seul!
    Par dark poulpo dans le forum Framework .NET
    Réponses: 3
    Dernier message: 05/03/2012, 17h09
  2. [XL-2003] displayalert=false mais erreur tout de même
    Par comme de bien entendu dans le forum Macros et VBA Excel
    Réponses: 0
    Dernier message: 23/01/2012, 11h59
  3. Réponses: 3
    Dernier message: 12/05/2006, 12h34
  4. Réponses: 10
    Dernier message: 16/03/2006, 11h31

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