• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Local Lookup Problem in WSAD!!

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This topic has been discussed in detail in many forums, but i am yet to find a solution, please help me here!!

I am trying to lookup a local entity bean from a session bean:
//jndiName = java:comp/env/ejb/EntityBMP ,
Object obj = initialContext.lookup( jndiName );
I have tried almost every combination of providing the jndi name, but i get the following exceptions.


I am getting the following exception when i try to use the jndi name directly :
First component in name ejb/EntityBMP not found.

When i try to use java:comp/env/ejb/EntityBMP, i am getting the following exception:
Name comp/env/ejb not found in context "java:"


I have declared a reference as shown :
< !-- Bean managed Entity Beans -->
<entity id="EntityBMPBean">
<ejb-name>EntityBMPBean</ejb-name>
<local-home>com.test.EntityBMPLocalHome</local-home>
<local>com.test.EntityBMPLocal</local>
<ejb-class>com.test.EntityBMPBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>com.test.EntityBMPPK</prim-key-class>
<reentrant>False</reentrant>
<ejb-local-ref id="EJBLocalRef_1121607049168">
<ejb-ref-name>ejb/EntityBMPBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.test.EntityBMPLocalHome</local-home>
<local>com.test.EntityBMPLocal</local>
<ejb-link>EntityBMPBean</ejb-link>
</ejb-local-ref>
<resource-ref>
<res-ref-name>jdbc/dataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>


---------------------------------------

The binding is as shown:
<ejbBindings xmi:id="EnterpriseBeanBinding_7" jndiName="ejb/EntityBMP">
<enterpriseBean xmi:type="ejb:Entity" href="META-INF/ejb-jar.xml#EntityBMPBean"/>
<ejbRefBindings xmi:id="EjbRefBinding_1121607049168" jndiName="EntityBMP">
<bindingEjbRef xmi:type="common:EJBLocalRef" href="META-INF/ejb-jar.xml#EJBLocalRef_1121607049168"/>
</ejbRefBindings>
</ejbBindings>


Could some please tell what could be missing ??

Regards,
Harsha
 
harsha av
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there seems to be some formatting problem:in my earlier post

< !-- Bean managed Entity Beans <br /> <entity id="EntityBMPBean"><br /> <ejb-name>EntityBMPBean</ejb-name><br /> <local-home>com.test.EntityBMPLocalHome</local-home><br /> <local>com.test.EntityBMPLocal</local><br /> <ejb-class>com.test.EntityBMPBean</ejb-class><br /> <persistence-type>Bean</persistence-type><br /> <prim-key-class>com.test.EntityBMPPK</prim-key-class><br /> <reentrant>False</reentrant><br /> <ejb-local-ref id="EJBLocalRef_1121607049168"><br /> <ejb-ref-name>ejb/EntityBMPBean</ejb-ref-name><br /> <ejb-ref-type>Entity</ejb-ref-type><br /> <local-home>com.test.EntityBMPLocalHome</local-home><br /> <local>com.test.EntityBMPLocal</local><br /> <ejb-link>EntityBMPBean</ejb-link><br /> </ejb-local-ref><br /> <resource-ref><br /> <res-ref-name>jdbc/dataSource</res-ref-name><br /> <res-type>javax.sql.DataSource</res-type><br /> <res-auth>Container</res-auth><br /> </resource-ref><br /> </entity><br /> <br /> <br /> <ejbBindings xmi:id="EnterpriseBeanBinding_7" jndiName="ejb/EntityBMP"><br /> <enterpriseBean xmi:type="ejb:Entity" href="META-INF/ejb-jar.xml#EntityBMPBean"/><br /> <ejbRefBindings xmi:id="EjbRefBinding_1121607049168" jndiName="EntityBMP"><br /> <bindingEjbRef xmi:type="common:EJBLocalRef" href="META-INF/ejb-jar.xml#EJBLocalRef_1121607049168"/><br /> </ejbRefBindings><br /> </ejbBindings><br /> -->
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prefix local:ejb to the jndi name.
So let your jndi name when you create the bean be ejb/<bean name>.
When you look up prefix local:ejb to the jndi name so you will lookup using

local:ejb/ejb/<bean name>.
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic