The problem is most likely two fold: The first being, this line: System.setSecurityManager(new RMISecurityManager()); Which causes this error: java.rmi.UnexpectedException: undeclared checked exception; nested exception is: java.lang.IllegalArgumentException: Bad permission name: enableSubtitution at _ZN4java4lang11VMThrowable16fillInStackTraceEPNS0_9ThrowableE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9Throwable16fillInStackTraceEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9ThrowableC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9ExceptionC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java2io11IOExceptionC1EPNS_4lang6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java3rmi15RemoteExceptionC1EPNS_4lang6StringEPNS2_9ThrowableE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java3rmi19UnexpectedExceptionC1EPNS_4lang6StringEPNS2_9ExceptionE (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu4java3rmi8registry17RegistryImpl_Stub6rebindEPN4java4lang6StringEPNS4_3rmi6RemoteE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java3rmi6Naming6rebindEPNS_4lang6StringEPNS0_6RemoteE (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu3gcj7runtime11FirstThread9call_mainEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu3gcj7runtime11FirstThread3runEv (/usr/local/lib/libgcj.so.4.0.0) at _Z13_Jv_ThreadRunPN4java4lang6ThreadE (/usr/local/lib/libgcj.so.4.0.0) at _Z11_Jv_RunMainPN4java4lang5ClassEPKciPS4_b (/usr/local/lib/libgcj.so.4.0.0) at JvRunMain (/usr/local/lib/libgcj.so.4.0.0) at __libc_start_main (/lib/libc-2.2.5.so) at _start (Unknown Source) Caused by: java.lang.IllegalArgumentException: Bad permission name: enableSubtitution at _ZN4java4lang11VMThrowable16fillInStackTraceEPNS0_9ThrowableE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9Throwable16fillInStackTraceEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9ThrowableC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9ExceptionC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang16RuntimeExceptionC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang24IllegalArgumentExceptionC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java2io22SerializablePermissionC1EPNS_4lang6StringES4_ (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java2io22SerializablePermissionC1EPNS_4lang6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java2io17ObjectInputStream19enableResolveObjectEb (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu4java3rmi6server20RMIObjectInputStreamC1EPN4java2io11InputStreamE (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu4java3rmi6server17UnicastConnection20getObjectInputStreamEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu4java3rmi6server17UnicastRemoteCall14getInputStreamEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu4java3rmi6server17UnicastRemoteCall11executeCallEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu4java3rmi6server10UnicastRef6invokeEPN4java3rmi6server10RemoteCallE (/usr/local/lib/libgcj.so.4.0.0) ...9 more But once that line is removed, the following occurs: If you use the rmiregistry program that is created by GCC 3.3 (I did a new install and compiled GCC 3.3), and run the provided server and client against it (server source is com.romulin.rmi.RMIServerImpl and client source is com.romulin.rmi.TestClient), it produces the following: java.rmi.UnexpectedException: undeclared checked exception; nested exception is: java.lang.ArrayIndexOutOfBoundsException: 0 >= 0 at _ZN4java4lang11VMThrowable16fillInStackTraceEPNS0_9ThrowableE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9Throwable16fillInStackTraceEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9ThrowableC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java4lang9ExceptionC1EPNS0_6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java2io11IOExceptionC1EPNS_4lang6StringE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java3rmi15RemoteExceptionC1EPNS_4lang6StringEPNS2_9ThrowableE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java3rmi19UnexpectedExceptionC1EPNS_4lang6StringEPNS2_9ExceptionE (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu4java3rmi8registry17RegistryImpl_Stub6rebindEPN4java4lang6StringEPNS4_3rmi6RemoteE (/usr/local/lib/libgcj.so.4.0.0) at _ZN4java3rmi6Naming6rebindEPNS_4lang6StringEPNS0_6RemoteE (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu3gcj7runtime11FirstThread9call_mainEv (/usr/local/lib/libgcj.so.4.0.0) at _ZN3gnu3gcj7runtime11FirstThread3runEv (/usr/local/lib/libgcj.so.4.0.0) at _Z13_Jv_ThreadRunPN4java4lang6ThreadE (/usr/local/lib/libgcj.so.4.0.0) at _Z11_Jv_RunMainPN4java4lang5ClassEPKciPS4_b (/usr/local/lib/libgcj.so.4.0.0) at JvRunMain (/usr/local/lib/libgcj.so.4.0.0) at __libc_start_main (/lib/libc-2.2.5.so) at _start (Unknown Source) Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 >= 0 <<No stacktrace available>> The example will throw this error and then create it's own RMI registry and the client will work. This error does not occur when you use the rmiregistry from Sun JDK 1.4.1_02 (that is, everything functions as expected, except the problem with Security as stated above as it affect RMIServerImpl under Sun's JDK as well). Release: GCJ-3.3 Environment: Slackware Linux 8.1 default setup (no previous GCJ) How-To-Repeat: rmiregistry 1099 & ./server & -- error is thrown
The permissions bug is fixed in libgcj/10838. I've confirmed the ArrayIndexOutOfBounds exception on mainline.
Created attachment 4061 [details] RMI/serialization patch Can you try the attached patch? Your example worked for me with this patch on mainline. I'm not positive the returnValue() fix is correct, I don't know RMI that well. Moreover the RMI in libgcj isn't tested much at all. If you have RMI apps you could try on it that'd be a big help.
Well, the suggested patch seems to work for me (didn't throw the exception). I don't want to assume anything, but... well... it worked :->
Patch applied to mainline.