Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javax.ejb.EJBException: Unable to lookup HandleDelegate

Status
Not open for further replies.

juliaroberts

Programmer
Apr 13, 2000
58
US
Hi,

I have a problem when I call the getHandle() method on a remote interface of an EJB Object. My ejbs are deployed in JRun 4.0 app server. I am using JDK 1.3 version on both the client and the server. This is the code:-

public static void main(String[] args) {
try {

// setup parameter for getting the initial context
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY, "jrun.naming.JRunContextFactory");
h.put(Context.PROVIDER_URL, "localhost:2908");

// get the initial context
Context ctx = new InitialContext(h);

// Lookup the home interface of a specified bean.
HelloHome hb = (HelloHome)ctx.lookup("Test/Hello");

// print the home interface
System.out.println("Home Ojb = " + hb);

// get the remote interface
Hello hbRemote = (Hello)hb.create();

// print out the remote interface
System.out.println("Remote Interface = " + hbRemote);

// call invoke a method that just return "Hello, " + String that you passed in
// in this case "Hello, Good Day"
System.out.println("Remote call returns = " + hbRemote.addHello("Good Day"));

// now go get the handle for this remote interface
javax.ejb.Handle remoteH = hbRemote.getHandle();
System.out.println("Handles = " + remoteH);
} catch (Exception e) {
e.printStackTrace();
}
}
Output on console is following

C:\testbean\jruntest>java -cp jruntest.jar;jrun.jar testhello.TestHello
Home Ojb = helloejb.jar#hello.HelloBean
Remote Interface = helloejb.jar#hello.HelloBean
Remote call returns = Hello, Good Day
handle is = jrun.ejb.portable.HandleImpl@ec366a

javax.ejb.EJBException: Unable to lookup HandleDelegate
at jrun.ejb.portable.HandleImpl.readObject(HandleImpl.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at java.io_ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:809)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1733)
at java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:322)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at jrunx.rmi.Invocation.unmarshall(Invocation.java:404)
at jrunx.rmi.Invocation.getMethodResult(Invocation.java:237)
at jrunx.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:139)
at jrun.ejb.invocation.ClientInvocationHandlerImpl.invoke(ClientInvocationHandlerImpl.java:221)
at $Proxy2.getHandle(Unknown Source)
at testhello.TestHello.main(TestHello.java)
Handles = null


Can anyone please help?


 

I'm having the same problem using Sun's J2SDKEE as a server.
Did you find a way around it?

Suran AT gmx DOT net
 
No solution in sight. I get this problem with IBM JDK as well as Sun JDK. Any help would be greatly apppreciated.

Thanks in advance
 
I have solved it for me. j2ee.jar was not in the classpath of the client.
Hope it helps.

Marcus
 
Suran.
I tried your solution. I added j2ee.jar to teh classpath of the client.
Good news and Bad news.
Good news is that I am not getting the "unable to lookup HandleDelegate" exception. Now the exception is

java.lang.ClassCastException: $Proxy2
at com.sun.enterprise.iiop.IIOPHandleDelegate.getStub(IIOPHandleDelegate
.java:62)
at com.sun.enterprise.iiop.IIOPHandleDelegate.readEJBObject(IIOPHandleDe
legate.java:42)
at jrun.ejb.portable.HandleImpl.readObject(HandleImpl.java:89)
at java.lang.reflect.Method.invoke(Native Method)
at java.io_ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2
219)
at java.io_ObjectInputStream.inputObject(ObjectInputStream.java:1416)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:392)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:242)
at java.rmi.MarshalledObject.get(MarshalledObject.java:144)
at jrunx.rmi.Invocation.unmarshall(Invocation.java:404)
at jrunx.rmi.Invocation.getMethodResult(Invocation.java:237)
at jrunx.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java
:139)
at jrun.ejb.invocation.ClientInvocationHandlerImpl.invoke(ClientInvocati
onHandlerImpl.java:221)
at $Proxy2.getHandle(Unknown Source)
at george.ui.client.main(client.java:26)


Did you get a similar problem? Are there any other jars to set to the classpath?

Thanks in advance
 
Are you getting this error when you lookup your Home stub or when you try to create your Remote reference?
 
I am able to lookup the home interface. From the home interface I am able to get the remote interface. The problem occurs when I call the getHandle() method of the remote interface. Initially it was "unable to lookup Handle Delegate"; this was solved after Suran told me to put j2ee.jar in my client classpath. I know get a classcastexception.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top