Remote not bound dans un ejb entity
bonjour
je suis débutant avec les ejb,j'ai suivi un tutoriel d'eclipsetotale pour développer un ejb entity le déploiment se fait avec succée quand je l'appelle mon ejb avec un une application cliente qui a le code suivant :
Code:
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
| package clientpack;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import projetejb3.GestionDeStock;
import projetejb3.Produit;
public class TestEntity {
public static void main(String[] args) {
Properties env = new Properties();
env.put("java.naming.factory.initial", "org.jboss.naming.NamingContextFactory");
env.put("java.naming.provider.url","jnp://localhost:1099");
env.put("java.naming.factory.url.pkgs", "localhost:1099");
Context initialContext = null;
try{
Context con=new InitialContext(env);
GestionDeStock stock=(GestionDeStock) con.lookup("GestionDeStockBean/Remote");
stock.ajouter(new Produit("001", "Tomate", 100));
stock.ajouter(new Produit("002", "Pomme de terre", 5680));
stock.ajouter(new Produit("003", "Orange", 23));
stock.ajouter(new Produit("004", "Carotte",115));
stock.ajouter(new Produit("005", "Muscadet", 48));
List<Produit> produits = stock.ListerToutLesProduits();
for (Iterator iter = produits.iterator(); iter.hasNext();) {
Produit eachProduit = (Produit) iter.next();
System.out.println(eachProduit);
}
} catch (NamingException e) {
System.err.println("Impossible d'accéder au contexte JNDI : " + e);
System.exit(2);
}
}
} |
le message d'erreur est le suivant:
Impossible d'accéder au contexte JNDI : javax.naming.NameNotFoundException: Remote not bound
votre aide svp et merci d'avance