• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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

 
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) {
. . . . . . . .
}
. . . . . . . .
}
 
The moustache of a titan! The ad of a flea:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!