• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB problem

 
Chris Chua
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all I have a simple problem with EJB what i wanted is to get the reference of another Enterprise bean I have used this code in my Bean class
Context con = new InitialContext()
Context enviroment = (Context) con.lookup("java:comp/env/nameofbean");
otherBeanHome home = (otherBeanHome) enviroment.lookup("name");
i have already set the reference area in the deployment tool however when i ran it it throws an exception NoClassDefError
I tried another code to call the other bean like
Context con = new InitialContext();
Object objectRef = con.lookup("name");
otherBeanHome home = (OtherBeanHome) PortableRemoteObject.narrow(objectRef, otherBeanHome.class);
otherBean bean = home.create();
this code still throws the NoClassDefError could somebody pls help me by explaining what i should do to get an reference of another enterprise bean. I am using the j2sdkee1.3 server
Thanks in advance
Thanks Chris

[This message has been edited by Chris Chua (edited August 27, 2001).]
 
Mahesh Kulkarni
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris,
Write a simple method as follows.
static public Context getInitialContext() throws Exception
{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.TengahInitialContextFactory");
return new InitialContext(p);
}

Call this method as follows in EjbCreate/or in a seperate method and call that method in EJBCreate(if in seperate method)
try
{
ictx=getInitialContext();
home=(OtherBeanHome) ictx.lookup("name");
}
catch (Exception e)
{
e.printStackTrace();
throw e;
}
Thanx
Mahesh
 
Chris Chua
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mahesh
Thanks for your reply, but I think that works with weblogic server only. Some things are vendor specific, could you help me with some code that would work in j2sdkee1.3 server?
Thanks
Chris
 
rajesh boorla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am learning ejbs and i have deployed simple ejb in websphere3.5 successfully but when i am running the client program i am getting the error :
java.lang.NoClassDefFoundError rg/omg/Cosnaming/NamingContextOpertaion
so can any body help me in solving this problem
rajesh.
 
rajesh boorla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am learning ejbs and i have deployed my ejb sucessfully in websphere 3.5 when i am trying to run my client program i am getting the error:
javax.naming.CommunicationException:can't find serial context provider
so can any body help me to solve the problem.
rajesh.
 
srilatha kodati
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am learning ejbs and i have deployed successfully in websphere3.5 but when i try to run my client program i am getting the error:
javax.naming.CommunicationException:can't find serialcontextprovider
so if any body knows how to solve the problem please let me know....
srilatha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic