Bonsoir,

Je rencontre un problème assez commun apparemment, mais je n'ai pas encore trouvé de réponse sur la toile.
Mon soucis à l'exécution lors du lookup :
javax.naming.NameNotFoundException: WineSession not bound
J'ai un projet EJB dont voici l'interface et le session bean :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package com.ejb.IEJBSession;
 
import java.util.List;
 
import javax.ejb.Local;
import javax.ejb.Remote;
 
import com.ejb.entity.Wine;
 
@Remote
public interface IWineSession {
	public void add(Wine wine);
	public List<Wine> showListOfWines();
}
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
package com.ejb.EJBSession;
 
import java.util.List;
 
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
 
import com.ejb.IEJBSession.IWineSession;
import com.ejb.entity.Wine;
 
@Stateless
public class WineSession implements IWineSession {
	@PersistenceContext(name="WineEJB3")
	private EntityManager em;
	@Override
	public void add(Wine wine) {
		// TODO Auto-generated method stub
		em.persist(wine);
	}
 
	@Override
	public List<Wine> showListOfWines() {
		// TODO Auto-generated method stub
		return null;
	}
 
}
Coté client :
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
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
 
import com.ejb.IEJBSession.IWineSession;
import com.ejb.entity.Wine;
 
 
public class WineCaveManager {
	public static void main(String[] args){
		try {
			Context context = new InitialContext();
			IWineSession wine = (IWineSession) context.lookup("WineSession/remote");
			wine.add(new Wine(1,"Lirac"));
			wine.add(new Wine(2,"Bordeaux"));
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
 
	}
}
Fichier jndi.properties dans le répertoire src du projet Java client :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099
Merci d'avance pour votre aide.