File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Lookup problem with EJB3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Lookup problem with EJB3" Watch "Lookup problem with EJB3" New topic
Author

Lookup problem with EJB3

Pradeep Bhat
Greenhorn

Joined: Jan 12, 2008
Posts: 29
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

Joined: Jul 20, 2005
Posts: 10105
    
165

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:




[My Blog] [JavaRanch Journal]
Pradeep Bhat
Greenhorn

Joined: Jan 12, 2008
Posts: 29
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

Joined: Jul 20, 2005
Posts: 10105
    
165

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lookup problem with EJB3