| Author |
JNDI in JBOSS
|
Walker Rustin
Ranch Hand
Joined: Mar 08, 2004
Posts: 37
|
|
I have gone through the material at JBoss and still not sure how JNDI works in JBOSS. Here is an example of jboss.xml. The code works but I am not sure where I am mapping java:comp/env/ejb/user to the user ejb. <?xml version='1.0' encoding='UTF-8' ?> <jboss> <enterprise-beans> <entity> <ejb-name>UserEJB</ejb-name> <local-jndi-name>MyUser</local-jndi-name> <resource-ref> <res-ref-name>jdbc/BankDB</res-ref-name> <jndi-name>java:/DefaultDS</jndi-name> </resource-ref> </entity> <session> <ejb-name>UserControllerEJB</ejb-name> <local-jndi-name>MyUserController</local-jndi-name> <ejb-local-ref> <ejb-ref-name>ejb/user</ejb-ref-name> <local-jndi-name>MyUser</local-jndi-name> </ejb-local-ref> </session> </enterprise-beans> </jboss> thanks. - walk rustin
|
SCBCD
|
 |
Asad Zaman
Greenhorn
Joined: Feb 16, 2003
Posts: 6
|
|
Hi rustin, You can easily find out the mapping if you look at the ejb-jar.xml. As you've declared <ejb-local-ref> as follows: <ejb-local-ref> <ejb-ref-name>ejb/user</ejb-ref-name> <local-jndi-name>MyUser</local-jndi-name> </ejb-local-ref> This means that you are declaring a name "user" in the JNDI ENC tree java:comp +- env | +- jdbc | | +- BankDB [link -> java:/DefaultDS] | +- ejb | | +- user The BankDB name under jdbc is the JDBC name you have declated in your ejb-jar.xml You can look out the JNDI ENC tree of all names your JBossAS has prepared for you. 1. Run your JBossAS 2. Open your browser and type http://localhost:8080/jmx-console in the address bar and press enter. you should see JMX Agent View of JBossAS. This is the MBean page of JBoss. 3. In the jboss section you should see a link service=JNDIView. Click this link. You should now see JNDIView Service MBean view. Scroll down the page until you can see a operation name named "list". Press the invoke button of list operation. You should be navagated to the result page of the list operation. 4. Find out a section named Ejb Module: xxx.jar section. (here xxx.jar is the name of file name of your EJB). And see what JNDI tree is constructed from your EJB by JBossAS. Play with the jmx-console for sometime. I am sure you will be cleared all of your Questions. ---- Asad Zaman
|
 |
 |
|
|
subject: JNDI in JBOSS
|
|
|