• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNDI lookup problem with ejb local interfaces

 
john b. smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone ever gotten an ejb cmp entity bean with (only) local interfaces to work? That is, has anyone been able to do a lookup using JNDI on one and then either a cast or narrow to get the LocalHome interface?
I've read everyting I can find on this, tried everything I can think of, and am still hung up after a week's work. (I need to do this since I am using entity relationships which are defined only on the local interfaces.) This includes Kyle's suggestions of March 4, Mike Cox's "Use java:comp to Locate . . . " article, developerWorks' "Deploying multiple applications . . . " article. Etc. I'm stymied and wonder if anyone has ever gotten a local ejb interface to work. I am using WSAD 5.0.1 on a Windows XP machine.
Here are the specifics:
0. I do have a specified DataSource that I can lookup using the "java:comp/env/NAME" form for the local JNDI namespace, and I have looked at the .xml files which seem similar to those I have for my ejbs.
1. I have a cmp ejb with (only) local interfaces, called Set, withich generates SetBean, SetLocal, and SetLocalHome.
2. Under the deployment descriptor's References tab, I create an "EJBLocalRef" called ejb/SetLocalHome. I corretly points to the Local and LocalHome for the bean and results in the following WebSphere Baindings;" ejb/ooc/ejb/td/set/SetHome.
3. In the ejb.jar file, the folowing appears:
<ejb-local-ref id="EJBLocalRef_1065716243405">
<description></description>
<ejb-ref-name>ejb/SetLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>ooc.ejb.td.set.SetLocalHome</local-home>
<local>ooc.ejb.td.set.SetLocal</local>
<ejb-link>Set</ejb-link>
</ejb-local-ref>
That looks right to me.
4. In the ibm-ejb-jar-bnd.xmi file, the following appears:
<ejbBindings xmi:id="EnterpriseBeanBinding_1062775164067" jndiName="ejb/ooc/ejb/td/set/SetHome">
<enterpriseBean xmi:type="ejb:ContainerManagedEntity" href="META-INF/ejb-jar.xml#Set"/>
<ejbRefBindings xmi:id="EjbRefBinding_1065716243405" jndiName="ejb/ooc/ejb/td/set/SetHome">
<bindingEjbRef xmi:type="common:EJBLocalRef" href="META-INF/ejb-jar.xml#EJBLocalRef_1065716243405"/>
</ejbRefBindings>
</ejbBindings>
5. My code to lookup the local interface is the following:
SetLocalHome setLocalHome = null;
InitialContext context;
context = new InitialContext();
Object obj = context.lookup( "java:comp/env/ejb/SetLocalHome" );
setLocalHome = (SetLocalHome)(javax.rmi.PortableRemoteObject.narrow( obj, SetLocalHome.class ));
6. After "generating deployment and rmic code" and rebuilding the project, I get the following error (within a NameingException block):
Naming Error in SetMapper.getSetLocalHome.JNDI lookup: Name comp/env/ejb not found in context "java:".
7. I can see the global-named SetHome" interface in the JNDI client test program, but haven't been able to do a direct invokation using any name I can think of to use.
8. I have tried every combination of name, build and deploy sequence, and everything else I can think of, including rebooting system to get a fresh JNDI server, stoping WAS while WSAD is running, etc., etc.
9. HELP!!!
 
john b. smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops:
Here are version of 3 and 4 from my earlier post, which I hope will show up:
<pre>
3. In the ejb.jar file, the folowing appears:
<ejb-local-ref id="EJBLocalRef_1065716243405">
<description></description>
<ejb-ref-name>ejb/SetLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>ooc.ejb.td.set.SetLocalHome</local-home>
<local>ooc.ejb.td.set.SetLocal</local>
<ejb-link>Set</ejb-link>
</ejb-local-ref>
That looks right to me.
4. In the ibm-ejb-jar-bnd.xmi file, the following appears:
<ejbBindings xmi:id="EnterpriseBeanBinding_1062775164067" jndiName="ejb/ooc/ejb/td/set/SetHome">
<enterpriseBean xmi:type="ejb:ContainerManagedEntity" href="META-INF/ejb-jar.xml#Set"/>
<ejbRefBindings xmi:id="EjbRefBinding_1065716243405" jndiName="ejb/ooc/ejb/td/set/SetHome">
<bindingEjbRef xmi:type="common:EJBLocalRef" href="META-INF/ejb-jar.xml#EJBLocalRef_1065716243405"/>
</ejbRefBindings>
</ejbBindings>
</pre>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic