wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes JNDI lookup and Bean not bound Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JNDI lookup and Bean not bound Exception" Watch "JNDI lookup and Bean not bound Exception" New topic
Author

JNDI lookup and Bean not bound Exception

selvaraju sellamuthu
Ranch Hand

Joined: Jun 28, 2007
Posts: 53
In our project we are using service locator for looking up Bean,to get Contry and City list from two entities,i used one action class,Country bean is working,but city bean is not bounded,exception is below
selvaraju sellamuthu
Ranch Hand

Joined: Jun 28, 2007
Posts: 53
Above exception is got in JBoss 4.2.2GA Server, Struts2+ejb3.0
[ December 11, 2007: Message edited by: selvaraju sellamuthu ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Check your JNDI tree to see the jndi-name to which the bean is bound and then use that jndi-name to do the lookup. Follow these steps for listing the contents of JNDI tree in JBoss:

- Go to http://localhost:8080/jmx-console
- Search for service=JNDIView on the jmx-console page
- Click on that link
- On the page that comes up click on the Invoke button beside the list() method
- The page that comes up will show the contents of the JNDI tree.

On this page, search for your bean and see what's the jndi-name for that bean. If you find it difficult to understand the output of the JNDI tree, just post it here.


[My Blog] [JavaRanch Journal]
selvaraju sellamuthu
Ranch Hand

Joined: Jun 28, 2007
Posts: 53
Originally posted by Jaikiran Pai:
Check your JNDI tree to see the jndi-name to which the bean is bound and then use that jndi-name to do the lookup. Follow these steps for listing the contents of JNDI tree in JBoss:

- Go to http://localhost:8080/jmx-console
- Search for service=JNDIView on the jmx-console page
- Click on that link
- On the page that comes up click on the Invoke button beside the list() method
- The page that comes up will show the contents of the JNDI tree.

On this page, search for your bean and see what's the jndi-name for that bean. If you find it difficult to understand the output of the JNDI tree, just post it here.


Your guide was very useful.Now Can able to access the bean,why its happening some time(bean Not bounded exception). Can you give me details.
very thanks
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

why its happening some time(bean Not bounded exception). Can you give me details.


Sometime back i explained this here
[ December 12, 2007: Message edited by: Jaikiran Pai ]
selvaraju sellamuthu
Ranch Hand

Joined: Jun 28, 2007
Posts: 53
very thanks,the link is very useful to understand jndi lookup tree.
kalaiselvi Bhalerao
Greenhorn

Joined: Aug 19, 2011
Posts: 9

Check your JNDI tree to see the jndi-name to which the bean is bound and then use that jndi-name to do the lookup. Follow these steps for listing the contents of JNDI tree in JBoss:

- Go to http://localhost:8080/jmx-console
- Search for service=JNDIView on the jmx-console page
- Click on that link
- On the page that comes up click on the Invoke button beside the list() method
- The page that comes up will show the contents of the JNDI tree.

On this page, search for your bean and see what's the jndi-name for that bean. If you find it difficult to understand the output of the JNDI tree, just post it here.


Hi
I followed the above step
and found my JNDI tree
My Bean class is CalcImpl
So what should be my JNDI name in client code?

Also note I have used
@Stateless(mappedName="Firstcalc")
in my Bean class
So i used my client as
Calc cl=(Calc) ctx.lookup("Firstcalc");
but it threw exception as
Firstcalc not bound

so please let know what should be my look up statement.


Global JNDI Namespace
+- UserTransactionSessionFactory (proxy: $Proxy85 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
+- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
+- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
+- XAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- topic (class: org.jnp.interfaces.NamingContext)
+- ClusteredConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- ProfileService (class: AOPProxy$0)
+- queue (class: org.jnp.interfaces.NamingContext)
| +- DLQ (class: org.jboss.jms.destination.JBossQueue)
| +- ExpiryQueue (class: org.jboss.jms.destination.JBossQueue)
+- ClusteredXAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
+- ConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- jmx (class: org.jnp.interfaces.NamingContext)
| +- invoker (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor (proxy: $Proxy87 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
| +- rmi (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
+- TomcatAuthenticators (class: java.util.Properties)
+- CalcImpl (class: org.jnp.interfaces.NamingContext)
| +- local (class: Proxy for: example.ejb.Calc)
| +- local-example.ejb.Calc (class: Proxy for: example.ejb.Calc)

+- console (class: org.jnp.interfaces.NamingContext)
| +- PluginManager (proxy: $Proxy88 implements interface org.jboss.console.manager.PluginManagerMBean)
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Based on that jndi tree output, the jndi name should be "CalcImpl/local"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI lookup and Bean not bound Exception