• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lookup problem with EJB3

 
Pradeep Bhat
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone me why is my lookup failing
I tried out a simple stateless bean example.







jndi.properties : -


I am using JDK 1.5 and jboss-4.2.3.GA
But when I run the client i get

javax.naming.NameNotFoundException: SimpleBean 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:267)
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:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at TestClient.runTest(TestClient.java:8)
at TestClient.main(TestClient.java:16)





I also tried

SimpleBean bean = (SimpleBean) ctx.lookup("SimpleBean/remote");

It still fails
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default, in JBoss the jndi name of the session bean is of type:

Beans packaged in an EAR containing the EJB jar:

For remote interface

For local interface


Beans deployed as just jar files:

For remote interface

For local interface


So if you are packaging in a EAR named myapp.ear, then the jndi name will be:



 
Pradeep Bhat
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help.

Since I had give name="Example" in my Bean class....Example/remote works.

But also since I have given mappedName="SimpleBeanJNDI" ...shouldn't it also work with SimpleBeanJNDI.

I works that way with glassfish . Don't understand why it doesn't work with JBOSS
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep Bhat wrote:

But also since I have given mappedName="SimpleBeanJNDI" ...shouldn't it also work with SimpleBeanJNDI.



mappedName is not supported in JBoss for the bean definitions.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic