File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and Other Java EE Technologies and the fly likes Relationship EJBean-to-EJBean ...Cannot narrow without a stub Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "Relationship EJBean-to-EJBean ...Cannot narrow without a stub" Watch "Relationship EJBean-to-EJBean ...Cannot narrow without a stub" New topic
Author

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

dar
Ranch Hand

Joined: Nov 08, 2001
Posts: 45
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) {
. . . . . . . .
}
. . . . . . . .
}
 
 
subject: Relationship EJBean-to-EJBean ...Cannot narrow without a stub
 
Threads others viewed
JNDI not creating for EJB Local interfaces example
NameNotFoundException: 'ordermanagementLocal'
a session bean contacts an entity bean
client code
EJB Single Timer Bean Implementation
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture