• Post Reply Bookmark Topic Watch Topic
  • New Topic

Relationship EJBean-to-EJBean ...Cannot narrow without a stub

 
dar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody.
I have one enterprise bean referencing to another enterprise bean.
Here is "diagram" how is it constructed: stclient->guestBean->userBean.
I get this ugly error message:
java.lang.ClassCastException: Cannot narrow without a stub class: users._userHome_Stub
at com.inprise.vbroker.rmi.CORBA.PortableRemoteObjectImpl.narrow(Portabl
eRemoteObjectImpl.java:238)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at guests.guestBean.setGName(guestBean.java:27)
at java.lang.reflect.Method.invoke(Native Method)
What is wrong? I have JBuilder and ias.
Thanks for your help

//----- stclient.java
package clients;
import javax.naming.*;
import guests.*;
public class stclient {
public static void main(String args[]){
Context ctx;
Object objRef;
guestHome hm;
guest ejbr;
try{
ctx = new InitialContext();
objRef = ctx.lookup("guestJNDI");
hm = (guestHome) javax.rmi.PortableRemoteObject.narrow(objRef, guestHome.class);
ejbr = hm.create();
ejbr.setGName("guest.");
System.out.println(" * * * * * OK. * * * * * ");
}
catch(Exception e){
e.printStackTrace();
}
}
}
//-------- guestBean.java
package guests;
import users.*;
public class guestBean implements SessionBean {
. . . . . . . .
public void setGName(String m_guest) {
try{
Context ctx = new InitialContext();
Object objRef = ctx.lookup("userJNDI");
userHome uhm = (userHome) javax.rmi.PortableRemoteObject.narrow(objRef, userHome.class); //line 27
user ub = uhm.create();
ub.setUserName(m_guest);
}
catch(Exception e){
e.printStackTrace();
}
}
. . . . . . . .
}

//-------- userBean.java
package users;
. . . . . . . .
public class userBean implements SessionBean {
public void setUserName(String m_guest) {
. . . . . . . .
}
. . . . . . . .
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!