This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization 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
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Help with the local interface

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, could anyone help me?
I create an EJB(2.0)project, which contains CMP entity beans and session beans. And also I have a java project, I want to access the entity bean. When I do this:
-------------------------
InitialContext initialContext = new InitialContext();
AliasLocalHome aliasLocalHome = (AliasLocalHome)initialContext.lookup("com/ibm/ejb/entity/AliasLocalHome");
it will give me an error:
NamingException:
"com/ibm/ejb/entity/AliasLocalHome" can not be found.
-----------------------
I added a local EJB reference to ejb.xml
and do this:
--------------------------------
InitialContext initialContext = new InitialContext();
AliasLocalHome aliasLocalHome = (AliasLocalHome)initialContext.lookup(java:comp/env/ejb/Alias);
it gave me an error:
Message='Name ejb not found in context "java:comp/env".'
[5/7/03 10:47:37:937 EDT] 21fc7586 SystemErr R Stack Trace to immediately follow:
[5/7/03 10:47:37:947 EDT] 21fc7586 SystemErr R javax.naming.NameNotFoundException: Name ejb not found in context "java:comp/env".
---------------------------------------
Anybody know how to locate a local home interface from a java project?
Thanks a lot!
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post your EJB-JAR.xml file.
Kyle
 
xin wen
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kyle for replying.
I am able to locate the local entity bean interface from the session bean using the local reference, but I tried to call it from a java project(not an EJB), it gave me the Naming Exception error. I wander if the local interface can not be called from anywhere except a Session Bean?
This is my ejb.jar
<--<br /> <?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">;
< ejb-jar id="ejb-jar_ID">
< display-name>LMSEJB</display-name>
< enterprise-beans>
< entity id="ContainerManagedEntity_1052172169203">
< ejb-name>Alias</ejb-name>
< local-home>com.rippe.lms.global.ejb.entity.AliasLocalHome< /local-home>
< local>com.rippe.lms.global.ejb.entity.AliasLocal</local>
< ejb-class>com.rippe.lms.global.ejb.entity.AliasBean</ejb-class>
< persistence-type>Container< /persistence-type>
< prim-key-class>com.rippe.lms.global.ejb.entity.AliasKey< /prim-key-class>
< reentrant>False< /reentrant>
< cmp-version>2.x< /cmp-version>
< abstract-schema-name>Alias</abstract-schema-name>
< cmp-field id="CMPAttribute_1052172169133">
< field-name>firm< /field-name>
< /cmp-field>
< cmp-field id="CMPAttribute_1052172169143">
< field-name>userid< /field-name>
< /cmp-field>
< ejb-local-ref id="EJBLocalRef_1052252823985">
< description></description>
<e jb-ref-name>ejb/Alias</ejb-ref-name>
< ejb-ref-type>Entity</ejb-ref-type>
< local-home>com.rippe.lms.global.ejb.entity.AliasLocalHome< /local-home>
< local>com.rippe.lms.global.ejb.entity.AliasLocal< /local>
< ejb-link>Alias< /ejb-link>
< /ejb-local-ref>
< /entity>
< session id="Access">
< ejb-name>Access< /ejb-name>
< home>com.rippe.lms.global.ejb.session.AccessHome< /home>
< remote>com.rippe.lms.global.ejb.session.Access< /remote>
< ejb-class>com.rippe.lms.global.ejb.session.AccessBean< /ejb-class>
< session-type>Stateless< /session-type>
< transaction-type>Container< /transaction-type>
< ejb-local-ref id="EJBLocalRef_1052406041770">
< description>< /description>
< ejb-ref-name>ejb/Alias< /ejb-ref-name>
< ejb-ref-type>Entity< /ejb-ref-type>
< local-home>com.rippe.lms.global.ejb.entity.AliasLocalHome< /local-home>
< local>com.rippe.lms.global.ejb.entity.AliasLocal< /local>
< ejb-link>Alias< /ejb-link>
< /ejb-local-ref>
< /session>
< /enterprise-beans>
< /ejb-jar>
-->

[/LIST][LIST]
[ May 08, 2003: Message edited by: xin wen ]
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!