This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Could not access Local Session Bean using JNDI lookup 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 "Could not access Local Session Bean using JNDI lookup" Watch "Could not access Local Session Bean using JNDI lookup" New topic

Could not access Local Session Bean using JNDI lookup

Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
Hi EJB Guru,

I am quite new to EJB 3.0 but have had a good deal of success including using JNDI to lookup Remote Stateless Session Bean in EJB 3.0. However, looking up local Stateless Session Bean prove more challenging with I had anticipated. Here is my code as follows:

Output when running ClientAccessRemoteCalculator gives

1 + 1 = 2
1 - 1 = 0

Output when running ClientAccessLocalCalculator on JBoss AS 4.0.5 gives:

Exception in thread "main" javax.ejb.EJBException: Invalid invocation of local interface (null container)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(
at $Proxy0.add(Unknown Source) at ClientAccessLocalCalculator.main(

JNDIView in JMX-Console in JBoss:

Output when running ClientAccessLocalCalculator on SJSAS 9.0 gives:

Exception in thread "main" javax.naming.NameNotFoundException: bean.CalculatorLocal not found

I am using Application Client to lookup these Session Beans on Netbeans 5.5, JBoss AS 4.0.5 (EJB3 installer)/SJSAS 9.0

9.0, SDK 1.5.0_11 on Windows XP platform.

Any assistance would be much appreciated.

Many thanks,

Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
HI, I've got the same problem and I agree with you about client.

Anyway, this is the code which I'm using in my app client

that returns the following error from unix command line
Caught a NamingException eu.virtualLab.users.UsrSessionRemote not bound
javax.naming.NameNotFoundException: eu.virtualLab.users.UsrSessionRemote not bound

On Jboss Global JNDI Namespace
+- UsrSessionBean (class: org.jnp.interfaces.NamingContext)
| +- local (proxy: $Proxy90 implements interface eu.virtualLab.users.UsrSessionLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
| +- remote (proxy: $Proxy89 implements interface eu.virtualLab.users.UsrSessionRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
See this thread; local interfaces are only valid within the same JVM.
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10440

Originally posted by Alessandro Ilardo:

If you are looking up a remote interface then change the lookup to:

[My Blog] [JavaRanch Journal]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Could not access Local Session Bean using JNDI lookup
It's not a secret anymore!