wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Entity Bean Lookup Exception 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 "Entity Bean Lookup Exception" Watch "Entity Bean Lookup Exception" New topic
Author

Entity Bean Lookup Exception

Prashant Jani
Greenhorn

Joined: Mar 29, 2001
Posts: 5
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

Joined: Mar 29, 2001
Posts: 4
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

Joined: Mar 29, 2001
Posts: 5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Entity Bean Lookup Exception
 
Similar Threads
Web Services for EJB Session Beans
session bean contact an entity bean
Can Session bean and Entity Bean talk??
Calling Entity Bean from Sesion bean
Remote / Local beans problem (WSAD 5)