Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

How to do lookup for local ejb's in WSAD?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
On JNDI Explorer(in WSAD), When I do lookup for a local EJB, the
following error message is thrown.
IWAD0402E Could not perform lookup with the JNDI name: Name
comp/env/ejb not found in context "java:".
The lookup button in JNDI explorer page works for remote ejbs not for
local ejbs; however, I am able to see the local beans through drill
down to specific directory (Local EJB beans folder) for local beans.
Could anyone please assist me with this problem?.
Moreover, When I try to do a lookup for local beans thru JSP, it throws
javax.naming.NameNotFoundException: Name comp/env/ejb not found in
context "java:".
but remote beans works properly.
Below is the code from JSP:
.......
javax.naming.Context localCtx = new InitialContext();
ItemInfoLocalHome localHome =
(ItemInfoLocalHome)localCtx.lookup("java:comp/env/ejb/ItemInfoLocalHome");
.......

I appreciate all of your help in advance.
Thanks,
Pinal.
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically, you must define a local-ejb-ref for all local ejb that you want to lookup in WSAS. This is different than some Application Servers (such as WebLogic) that allow you to lookup straight against the local ejb's JNDI without a previously defined local-ejb-ref. It is a bit of a pain in the beginning, but you get accustomed to it and frankly you should be defining them anyways.
I am moving this thread to the IBM/Websphere Forum for any further discussion...
 
Pinal N Patel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
I did define <ejb-local-ref> in the deployment descriptor and still its not working. Below is the code from the ejb-jar.xml file.
<entity id="ItemInfo">
<ejb-name>ItemInfo</ejb-name>
<local-home>addr.ItemInfoLocalHome</local-home>
<local>addr.ItemInfoLocal</local>
<ejb-class>addr.ItemInfoBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>ItemInfo</abstract-schema-name>
<cmp-field id="CMPAttribute_1060962686266">
<field-name>id_item</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1060962686281">
<field-name>item_name</field-name>
</cmp-field>
<primkey-field>id_item</primkey-field>
<ejb-local-ref id="EJBLocalRef_1063027674531">
<description>This is the test to see if Local EJB is found thru jndi lookup.</description>
<ejb-ref-name>ejb/ItemInfoLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>addr.ItemInfoLocalHome</local-home>
<local>addr.ItemInfoLocal</local>
</ejb-local-ref>
</entity>
Any assistance will be greatly appreciated.
Thanks & Regards,
Pinal.
 
Pinal N Patel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
Previous message eliminated the tags. Hopefully, this will show the tags along with their values.

" <entity id="ItemInfo">
<ejb-name>ItemInfo</ejb-name>
<local-home>addr.ItemInfoLocalHome</local-home>
<local>addr.ItemInfoLocal</local>
<ejb-class>addr.ItemInfoBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>ItemInfo</abstract-schema-name>
<cmp-field id="CMPAttribute_1060962686266">
<field-name>id_item</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1060962686281">
<field-name>item_name</field-name>
</cmp-field>
<primkey-field>id_item</primkey-field>
<ejb-local-ref id="EJBLocalRef_1063027674531">
<description>This is the test to see if Local EJB is found thru jndi lookup.</description>
<ejb-ref-name>ejb/ItemInfoLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>addr.ItemInfoLocalHome</local-home>
<local>addr.ItemInfoLocal</local>
</ejb-local-ref>
</entity>"
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic