Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNDI lookup and Bean not bound Exception

 
selvaraju sellamuthu
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Above exception is got in JBoss 4.2.2GA Server, Struts2+ejb3.0
[ December 11, 2007: Message edited by: selvaraju sellamuthu ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
selvaraju sellamuthu
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
very thanks,the link is very useful to understand jndi lookup tree.
 
kalaiselvi Bhalerao
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on that jndi tree output, the jndi name should be "CalcImpl/local"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic