GCJ and RMI on Fedora Core 12

Craig W. Martin giarcwm@earthlink.com
Mon Aug 16 22:58:00 GMT 2010


All,

I always like to start by thanking all of you for what you do - in 
essence a magnificent job. Thus, please don't interpret my request for 
help as a complaint.

I am experiencing a very strange problem with my RMI server, which is 
built using GCJ as part of my application. This acts as a conduit to my 
web server. This code has been running great for several years under 
Fedora Core 6. I have recently ported the application to Fedora Core 12 
(GCJ 4.4.4) and the RMI link no longer works. Of course I undertook an 
extended investigation and have found some very strange behaviour.

In a nut shell I am getting a bogus address sent in the Stub to the 
client (17.0.0.0 to be exact). Yes, I have tried setting 
java.rmi.server.hostname to no avail (fixed IP or hostname). This was 
done prior to constructing the server object, of course. Even stranger 
is that if I compile Norbert Frese's RMI spy interop tester to run as a 
standalone, it still works - if I launch it (Norbert's GCJ server code) 
via a Thread in our Linux application it hands back the 17.0.0.0 in the 
stub every time (i.e. it fails too). Seems there is no way for me to 
impact the outcome. The other strange side effect is that in the server 
itself (run from my application thread) the server is unable to bind to 
//localhost:7777, but can bind to it when run as Norbert's demo external 
to our application. Specifying 127.0.0.1 instead of localhost gets me 
over this issue - but I am still left with the Client trying to connect 
to 17.0.0.0. So obviously running in my thread is changing something, 
but what?

***Here is the code used to launch the GCJ RMI server from my thread:***

char launchPriority[5];

JvCreateJavaVM(NULL);
JvAttachCurrentThread(NULL, NULL);

JArray<java::lang::String*> *args = NULL;

Server::main(args);

***Here is the spew for Norbert's rmispy application (please note the 
bogus unicastref address):****

RMICLIENT: connecting to //localhost:7777/rmitestsrv
getOutputStream() toport=7777
56105 -> 7777: write(byte[],off,len) =7
00000 4a 52 4d 49 00 02 4b JRMI..K

getInputStream() fromport=7777
56105 <- 7777: read(byte[],off,len) =16
00000 4e 00 09 6c 6f 63 61 6c 68 6f 73 74 00 00 1e 61 N..localhost...a

56105 -> 7777: write(byte[],off,len) =18
00000 00 xx xx xx xx xx xx xx xx xx xx xx xx xx 00 00 ..xx.xx.xx.xx.. 
<<<<<IP hidden by me>
00010 00 00 ..

56105 -> 7777: write(byte[],off,len) =54
00000 50 ac ed 00 05 77 22 00 00 00 00 00 00 00 00 00 Pᆲ■..w".........
00010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00020 02 44 15 4d c9 d4 e6 3b df 74 00 0a 72 6d 69 74 .D.M￉ᅯ₩;￟t..rmit
00030 65 73 74 73 72 76 estsrv

56105 <- 7777: read(byte[],off,len) =309
00000 51 ac ed 00 05 77 0f 01 d1 c1 52 b5 00 00 01 2a Qᆲ■..w..￑￁Rᄉ...*
00010 7c 03 83 79 80 02 73 7d 00 00 00 02 00 0f 6a 61 |.テyタ.s}......ja
00020 76 61 2e 72 6d 69 2e 52 65 6d 6f 74 65 00 11 53 va.rmi.Remote..S
00030 65 72 76 65 72 31 32 49 6e 74 65 72 66 61 63 65 erver12Interface
00040 70 78 72 00 17 6a 61 76 61 2e 6c 61 6e 67 2e 72 pxr..java.lang.r
00050 65 66 6c 65 63 74 2e 50 72 6f 78 79 e1 27 da 20 eflect.Proxyï¿¡'ï¿š
00060 cc 10 43 cb 02 00 01 4c 00 01 68 74 00 25 4c 6a ᅩ.Cᅨ...L..ht.%Lj
00070 61 76 61 2f 6c 61 6e 67 2f 72 65 66 6c 65 63 74 ava/lang/reflect
00080 2f 49 6e 76 6f 63 61 74 69 6f 6e 48 61 6e 64 6c /InvocationHandl
00090 65 72 3b 70 78 70 73 72 00 2d 6a 61 76 61 2e 72 er;pxpsr.-java.r
000a0 6d 69 2e 73 65 72 76 65 72 2e 52 65 6d 6f 74 65 mi.server.Remote
000b0 4f 62 6a 65 63 74 49 6e 76 6f 63 61 74 69 6f 6e ObjectInvocation
000c0 48 61 6e 64 6c 65 72 00 00 00 00 00 00 00 02 02 Handler.........
000d0 00 00 70 78 72 00 1c 6a 61 76 61 2e 72 6d 69 2e ..pxr..java.rmi.
000e0 73 65 72 76 65 72 2e 52 65 6d 6f 74 65 4f 62 6a server.RemoteObj
000f0 65 63 74 d3 61 b4 91 0c 61 33 1e 03 00 00 70 78 ectᅮaᄡム.a3....px
00100 70 77 31 00 0a 55 6e 69 63 61 73 74 52 65 66 00 pw1..UnicastRef.
00110 08 31 37 2e 30 2e 30 2e 30 00 00 84 e9 80 00 00 .17.0.0.0..ト←タ..
00120 00 00 00 00 00 d1 c1 52 b5 00 00 01 2a 7c 02 ec .....￑￁Rᄉ...*|.↓
00130 b0 80 00 00 78 ï¾°ï¾€..x

RMICLIENT: ---- TEST 0: call0() : String
RMICLIENT: java.rmi.ConnectException: Connection refused to host: 
17.0.0.0; nested exception is:
java.net.ConnectException: Connection timed out
java.rmi.ConnectException: Connection refused to host: 17.0.0.0; nested 
exception is:
java.net.ConnectException: Connection timed out
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
at 
java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at 
java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.call0(Unknown Source)
at Client12.<init>(Client12.java:49)
at Client12.main(Client12.java:132)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at 
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at 
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at net.nfrese.rmispy.SpySocketFactory.createSocket(SpySocketFactory.java:26)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 8 more
RMICLIENT: ---- TEST 1: call1()

I must admit I am stumped. It just seems that GCJ can't correctly 
determine the unicast address from within my thread. Again I would 
emphasize that this same code ran flawlessly for years under core 6. Any 
help would be most appreciated.

Best regards,

Craig Martin



More information about the Java mailing list