This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes NamingException 'null' with lookup of entiy bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NamingException Watch "NamingException New topic
Author

NamingException 'null' with lookup of entiy bean

chuck keuper
Greenhorn

Joined: Mar 17, 2004
Posts: 22
I have created a session bean (ProfileSession), an entity bean (Member), and a ProfileSessionTestClient with JBuilder9. Within the ProfileSessionTestClient I can lookup the jndi name "ProfileSession" for the session bean. The code is below:
try {
//get naming context
Context context = new InitialContext();
//look up jndi name
Object ref = context.lookup("ProfileSession");
//look up jndi name and cast to Home interface
profileSessionHome = (ProfileSessionHome) PortableRemoteObject.narrow(ref, ProfileSessionHome.class);
I am having a problem with the lookup of the entity bean within the getMember() in the ProfileSessonBean.java code. This code is listed below:
public String getMember(Integer ID) {
String strMemberName = null;
try {
Context ctx = new InitialContext();
Object obj = ctx.lookup("Member");
MemberHome aMemberHome = (MemberHome) PortableRemoteObject.narrow(obj, MemberHome.class);
Member aMember = aMemberHome.findByPrimaryKey(ID);
The error that is being returned is "Return value from getMember(1): NamingException 'null'.
". Can some one help?
 
Have you checked out Aspose?
 
subject: NamingException 'null' with lookup of entiy bean
 
jQuery in Action, 3rd edition