Probleme en ejb3 en eclipse
Bonjour
j'utilise eclipse WTP SDK 3.2
et jboss-4.0.3SP1
voila le code de l'interface :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| package com.ejb.web;
import javax.ejb.Remote;
@Remote
public interface SalutationEJB3 {
public String ditBonjour(String aQui);
} |
pour le bean :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| package com.ejb.web;
import javax.ejb.Stateless;
@Stateless
public class SalutationEJB3Bean implements SalutationEJB3 {
public String ditBonjour(String aQui) {
return "******************************************\n"+
"****** Bonjour " + aQui + " !!! ********\n"+
"******************************************\n";
}
} |
et voila le lookup :
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
| package com.java.web;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.ejb.web.SalutationEJB3;
public class SalutationEJB3Client {
@SuppressWarnings({ "unchecked"})
public static void main(String[] args) {
try {
java.util.Hashtable env = new java.util.Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
Context context = new InitialContext(env);
SalutationEJB3 beanRemote =
(SalutationEJB3)context
.lookup("SalutationEJB3Bean/remote");
System.out.println(beanRemote.ditBonjour("Charki"));
System.out.println(beanRemote.ditBonjour("les amis"));
} catch (NamingException e) {
e.printStackTrace();
}
}
} |
Mais ce message d'erreur s affiche est ce que vous pouvez m'aider et merci d'avance
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
| javax.naming.NameNotFoundException: SalutationEJB3Bean not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
at org.jnp.server.NamingServer.lookup(NamingServer.java:252)
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 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:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.java.web.SalutationEJB3Client.main(SalutationEJB3Client.java:31) |