Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity Bean Lookup Exception

 
Prashant Jani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using IPlanet NAS (SP1).
I want to call an entity bean from session bean. However i get lookup(Naming) exception.
The same code works fine when i call the bean from a servlet.
Can you tell me the possible reason for the look up failure fron S bean. Is there any other method to b followed in case of bean referring another bean ?
Other than findbyPrimaryKey the other finder methods give me an exception. I guess i dont have to write the code in my EJB class ??
Please help me on this.
regards
jani prashant
 
mcd
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to tell, with no code posted. Remember that in EJB 1.1 you have to specify the remote referenced in the deployment descriptor with the "ejb-ref" tag.
mcd
 
Prashant Jani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mcd:
It's hard to tell, with no code posted. Remember that in EJB 1.1 you have to specify the remote referenced in the deployment descriptor with the "ejb-ref" tag.
mcd

Well i am pating the code which i have used both in servlet ( which works) and the S'less session bean.

String JNDI_NAME="TestAcc";
javax.naming.Context initial=null;
java.util.Hashtable env =new java.util.Hashtable(1);
try{
initial = new javax.naming.InitialContext(env);
}
catch(Exception e) {
System.out.println("could not get initContext");
}
try{
Object objref = null;
objref = initial.lookup(JNDI_NAME);
//objref = initial.lookup("TestAcc"); // tried this also
TestAccHome home = (TestAccHome)PortableRemoteObject.narrow(objref, TestAccHome.class);
TestAcc duke = home.create("1", "Duke", "Earl", 50.00);
}
catch(javax.naming.NamingException e)
{
System.out.println("Lookup exception ");
}
catch(Exception e)
{
System.out.println("Lookup exception " + e);
}
I get "Lookup exception "

I guess this should be helpful to you.

regards
jani prashant
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic