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 :

problème de deploiement d'un Entity Bean CMP


Sujet :

JOnAS Java

  1. #1
    Futur Membre du Club
    Inscrit en
    Août 2006
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Août 2006
    Messages : 5
    Points : 5
    Points
    5
    Par défaut problème de deploiement d'un Entity Bean CMP
    Bonjour tout le monde
    Je suis nouveau dans le monde Java EE et je suis entrain de tester les EJB avec le tutorial de Stéphane TRAUMAT ( http://www.ashita-studio.com/tutoriaux/ejb/index.php), voila le premier test avec les Session bean se sont passés sans trop de soucis(avec Eclipse et Jope), mais avec un Entity Bean CMP persisté dans une base de données Mysql j'ai un message d'erreur au moment du déploiement :
    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
     
    javax.ejb.CreateException: java.lang.NullPointerException
    	at org.objectweb.jonas_gen.beans.JOnASClient_60047071Bean.ejbCreate(JOnASClient_60047071Bean.java:109)
    	at org.objectweb.jonas_gen.beans.JOnASClient_60047071Home.create(JOnASClient_60047071Home.java:84)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
    	at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:143)
    	at sun.rmi.transport.Transport$1.run(Transport.java:153)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    	at java.lang.Thread.run(Thread.java:595)
    	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    	at org.objectweb.carol.rmi.jrmp.server.JRemoteCall.executeCall(JRemoteCall.java:89)
    	at org.objectweb.carol.rmi.jrmp.server.JUnicastRef.performRemoteCall(JUnicastRef.java:194)
    	at org.objectweb.carol.rmi.jrmp.server.JUnicastRef.invoke(JUnicastRef.java:158)
    	at org.objectweb.jonas_gen.beans.JOnASClient_60047071Home_Stub.create(Unknown Source)
    	at beans.ClientClient.main(ClientClient.java:36)
    Au niveau du console d'administration de JOnAs j'ai un message d'erreur lègèrement différent:
    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
     
    Admin (jonas) > 2006-09-18 23:52:32,609 : ConnectionManager.getConnection : Conn
    ectionManager: should not be used outside a JOnAS Server
    2006-09-18 23:52:32,687 : JOnASClient_60047071Bean.ejbCreate : failed to create
    bean in database
    java.lang.NullPointerException
            at org.objectweb.jonas.dbm.ConnectionManager.getConnection(ConnectionMan
    ager.java:957)
            at org.objectweb.jonas.dbm.ConnectionManager.getConnection(ConnectionMan
    ager.java:891)
            at org.objectweb.jonas_gen.beans.JOnASClient_60047071Bean.ejbCreate(JOnA
    SClient_60047071Bean.java:89)
            at org.objectweb.jonas_gen.beans.JOnASClient_60047071Home.create(JOnASCl
    ient_60047071Home.java:84)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
            at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnica
    stServerRef.java:143)
            at sun.rmi.transport.Transport$1.run(Transport.java:153)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
    60)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:701)
            at java.lang.Thread.run(Thread.java:595)
    Ce qui fait penser que JOnAS ne peut acceder à une base de données distance non hébergé dans le serveur JOnAS lui même.

    Merci de m'aider à poursuivre ce tut trés instructif en passant

  2. #2
    Futur Membre du Club
    Inscrit en
    Août 2006
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Août 2006
    Messages : 5
    Points : 5
    Points
    5
    Par défaut
    Correction:
    Ces erreurs appairaissent lors de l'exécution du client dont voici le code

    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
     
    // ClientClient.java
    // mini Client for accessing bean Client
     
    package beans;
     
    import java.rmi.RemoteException;
    import java.util.Collection;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
     
    /**
     *
     */
    public class ClientClient {
     
        static Context ctx = null; 
        static ClientHome 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 = "ClientHome";
    	try {
    	    home = (ClientHome) PortableRemoteObject.narrow(ctx.lookup(bName), ClientHome.class);
                Client bean = home.create("10","Kane","Médoune");
     
                System.out.println("Bienvenue à " 
                		+ bean.getPrenom() + " " 
                		+ bean.getNom() + " " 
                		+ "  dans les Entity Beans CMP ");
    	} 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;
    	  }
    	}
     
    }
    Merci d'avance

Discussions similaires

  1. problème de persistence des entities bean
    Par amonray dans le forum JPA
    Réponses: 3
    Dernier message: 17/06/2008, 10h30
  2. EJB Entity Bean et problème de mapping
    Par bard123 dans le forum JPA
    Réponses: 13
    Dernier message: 07/03/2008, 08h54
  3. [EJB3 Entity] Synchronisation des CMP entity bean 3.0 avec la BD
    Par st0ne dans le forum Java EE
    Réponses: 9
    Dernier message: 13/11/2006, 13h39
  4. Réponses: 4
    Dernier message: 11/10/2006, 21h36
  5. [ Entity bean ] CMP
    Par hocinema dans le forum Websphere
    Réponses: 5
    Dernier message: 03/10/2003, 11h33

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