juliaroberts
Programmer
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.ibjectStreamClass.invokeReadObject(ObjectStreamClass.java:809)
at java.ibjectInputStream.readSerialData(ObjectInputStream.java:1733)
at java.ibjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
at java.ibjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.ibjectInputStream.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 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.ibjectStreamClass.invokeReadObject(ObjectStreamClass.java:809)
at java.ibjectInputStream.readSerialData(ObjectInputStream.java:1733)
at java.ibjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
at java.ibjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.ibjectInputStream.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?