learn java
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

Win a copy of The Software Craftsman this week in the Agile forum!
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(StatelessLocalProxy.java:75)
at $Proxy0.add(Unknown Source) at ClientAccessLocalCalculator.main(ClientAccessLocalCalculator.java:14)

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: 10403

Originally posted by Alessandro Ilardo:

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

[My Blog] [JavaRanch Journal]
Have you tried LearnNowOnline? http://www.learnnowonline.com/
subject: Could not access Local Session Bean using JNDI lookup