NameNotFoundException: Test not bound

2 respostas
Tiago_Farias

Olá pessoal,
estou aprendendo EJB e num exercício passado (bem simples, um HelloWorld em ambiente EJB/Jboss) obtive um erro q tah me matando…

javax.naming.NameNotFoundException: Test not bound

at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)

at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)

at org.jnp.server.NamingServer.getObject(NamingServer.java:543)

at org.jnp.server.NamingServer.lookup(NamingServer.java:296)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)

at sun.rmi.transport.Transport$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Unknown Source)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)

at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)

at sun.rmi.server.UnicastRef.invoke(Unknown Source)

at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)

at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)

at javax.naming.InitialContext.lookup(Unknown Source)

at HelloClient.main(HelloClient.java:18)
Tenho 2 projetos abertos: O Test - q contém as classes HelloWorld(stateless bean) e a sua interface remote HelloWorldRemote. O outro projeto é TestCliente q possui a classe HelloClient q faz a chamada remote do bean HelloWorld. Enfim, uso o código:

Properties properties = new Properties();

properties.put(java.naming.factory.initial,org.jnp.interfaces.NamingContextFactory);

properties.put(java.naming.factory.url.pkgs,"=org.jboss.naming:org.jnp.interfaces");

properties.put(java.naming.provider.url,localhost:1099);

InitialContext con = new InitialContext(properties);

Object obj = con.lookup(Test);

HelloWorldRemote h = (HelloWorldRemote)PortableRemoteObject.narrow(obj, HelloWorldRemote.class);

E acontece o erro acima na hora do lookup! Uso EJB 3.0, Java 6 e JBoss 4.2.2(q faz o deploy corretamente do meu bean).

Alguém pode por favor me ajudar??

Vlw! []s.

2 Respostas

R

Ele não tá achando o seu ejb no naming directory… tem certeza que o JNDI do seu EJB é só “Test” e não “ejb/Test” ou algo assim?

Se vc tiver feito o deploy dele corretamente, deve dar pra ver o JNDI dele do contexto /web-console do jboss… é só procurar o seu ejb-jar lá…

[]´s

Tiago_Farias

Abri novos projetos, transferi td pra eles… e agora funciona! Eu devo ter escolhido alguma opção errada na hora de criar os projetos…
Vlw de qq modo. []s

Criado 24 de fevereiro de 2008
Ultima resposta 25 de fev. de 2008
Respostas 2
Participantes 2