aspose file tools*
The moose likes Websphere and the fly likes How to do lookup for local ejb's in WSAD? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "How to do lookup for local ejb Watch "How to do lookup for local ejb New topic
Author

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

Pinal N Patel
Ranch Hand

Joined: Sep 05, 2003
Posts: 57
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.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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

Joined: Sep 05, 2003
Posts: 57
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

Joined: Sep 05, 2003
Posts: 57
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>"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to do lookup for local ejb's in WSAD?