You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Kyle Cho (JIRA)" <ji...@apache.org> on 2010/05/19 23:37:56 UTC
[jira] Created: (HARMONY-6514) java.rmi.server.codebase
java.rmi.server.codebase
------------------------
Key: HARMONY-6514
URL: https://issues.apache.org/jira/browse/HARMONY-6514
Project: Harmony
Issue Type: Bug
Components: JDK
Affects Versions: 5.0M13
Environment: ia32/linux
Reporter: Kyle Cho
Priority: Minor
It seems -Djava.rmi.server.codebase property not to work. Below are Si.java, S.java. and C.java to reproduce problem.
----------Si.java--------
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Si extends Remote {
public String s_print() throws RemoteException;
}
----------S.java---------
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class S implements Si {
public String s_print() throws RemoteException
{
return "string_s_print";
}
public static void main(String[] args) throws Exception
{
String s1 = "S_Print";
S s = new S();
Si stub = (Si) UnicastRemoteObject.exportObject(s, 0);
Registry registry = LocateRegistry.getRegistry();
registry.rebind(s1, stub);
}
}
----------C.java---------
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class C {
public static void main(String[] args) throws Exception
{
String s = "S_Print";
Registry registry = LocateRegistry.getRegistry();
System.out.println(((Si)(registry.lookup("S_Print"))).s_print());
}
}
1. Create stub.jar which contains Si.class and put it to /tmp/.
2. Run following commands.
(terminal 1)$ drlvm/deploy/jdk/jre/bin/java org.apache.harmony.rmi.registry.RegistryImpl
(terminal 2)$ drlvm/deploy/jdk/jre/bin/java -Djava.rmi.server.codebase=file:/tmp/stub.jar S
(terminal 3)$ drlvm/deploy/jdk/jre/bin/java C
>From terminal 1, following exception will be thrown.
Uncaught exception in Call from [204.247.208.90:43022]:
java.lang.ClassCastException
at
org.apache.harmony.rmi.transport.RMIObjectInputStream.resolveClass(RMIObjectInputStream.java:114)
at
java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1843)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:799)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:806)
at
java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2061)
at
java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:902)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2273)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2230)
at
org.apache.harmony.rmi.transport.RMIObjectInputStream.readRMIObject(RMIObjectInputStream.java:196)
at
org.apache.harmony.rmi.remoteref.UnicastServerRef.readParams(UnicastServerRef.java:544)
at
org.apache.harmony.rmi.remoteref.UnicastServerRef.processCall(UnicastServerRef.java:427)
at
org.apache.harmony.rmi.server.ServerConnection$1.run(ServerConnection.java:171)
at
java.security.AccessController.doPrivilegedImpl(AccessController.java:112)
at
java.security.AccessController.doPrivileged(AccessController.java:86)
at
org.apache.harmony.rmi.server.ServerConnection.run(ServerConnection.java:174)
at java.lang.Thread.run(Thread.java:669)
>From terminal 2, following exception will be thrown.
Uncaught exception in main:
java.rmi.UnmarshalException: Unable to read call return header: ; nested
exception is:
java.io.EOFException
at
org.apache.harmony.rmi.client.ClientRemoteCall.executeCall(ClientRemoteCall.java:179)
at
org.apache.harmony.rmi.remoteref.UnicastRef.invoke(UnicastRef.java:260)
at
org.apache.harmony.rmi.remoteref.UnicastRef.invoke(UnicastRef.java:150)
at
org.apache.harmony.rmi.registry.RegistryImpl_Stub.rebind(RegistryImpl_Stub.java:181)
at S.main(S.java:17)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:129)
at
org.apache.harmony.rmi.client.ClientRemoteCall.executeCall(ClientRemoteCall.java:165)
at
org.apache.harmony.rmi.remoteref.UnicastRef.invoke(UnicastRef.java:260)
... 3 more
Running the same test with IBM or SUN jdk 1.5 prints expected output as below.
(terminal 1)$ rmiregistry
(terminal 2)$ java -Djava.rmi.server.codebase=file:/tmp/stub.jar S
(terminal 3)$ java C
string_s_print
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.