This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java.rmi.RemoteException  RSS feed

 
Naty wills
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having problem in my RMI server. I am using red hat linux 9 with Jdk1.5.
Code is like this
import java.rmi.*;
import java.net.*;
public class AddServer {
public static void main(String args[]) {
try{
System.setSecurityManager(new RMISecurityManager());
System.out.println("server is ready");
AddServerImpl addServerImpl = new AddServerImpl();
Naming.rebind("AddServer", addServerImpl);
System.out.println("AddServer is ready now");
}

catch(Exception e){
System.out.println("Exception: " +e);


Error is this:
Exception: java.rmi.RemoteException: connection failed to host: ; nested exception is:

Any Help would be appreciated
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What line of the code is the error occurring on?

The line with the "Naming.rebind("AddServer", addServerImpl);" call?

It would also help if you posted the nested exception - if the exception is security related, it probably means you don't have a security policy set, or that your security policy is missing something. Otherwise, it's something like the rmiregistry isn't running, or there's a network issue, like a firewall blocking the call.
 
Naty wills
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate,
I am new in JAVA RMI. I check the rmiregistry,its running. I had set security policy file also.The Above mention problem is occuring when I an trying to run Server machine. I am using same Linux machine for both server and Client.
The exceptions while running the above code are:
java.net.UnknownHostException:
at 0x40268e17: java.lang.Throwable.Throwable(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x4025bcd2: java.lang.Exception.Exception(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x4026fbce: java.io.IOException.IOException(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x402f3d2a: java.net.UnknownHostException.UnknownHostException(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x40253f22: java.net.InetAddress.lookup(java.lang.String, java.net.InetAddress, boolean) (/usr/lib/./libgcj.
so.3)
at 0x402ed8ca: java.net.InetAddress.getByName(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x402ef323: java.net.Socket.Socket(java.lang.String, int) (/usr/lib/./libgcj.so.3)
at 0x40320b96: gnu.java.rmi.server.RMIDefaultSocketFactory.createSocket(java.lang.String, int) (/usr/lib/./libg
cj.so.3)
at 0x40321753: gnu.java.rmi.server.UnicastConnectionManager.getClientConnection() (/usr/lib/./libgcj.so.3)
at 0x403216a4: gnu.java.rmi.server.UnicastConnectionManager.getConnection() (/usr/lib/./libgcj.so.3)
at 0x40321adc: gnu.java.rmi.server.UnicastRef.invokeCommon(java.rmi.Remote, java.lang.reflect.Method, java.lang
.Object[], int, long) (/usr/lib/./libgcj.so.3)
at 0x40321aa8: gnu.java.rmi.server.UnicastRef.invoke(java.rmi.Remote, java.lang.reflect.Method, java.lang.Objec
t[], long) (/usr/lib/./libgcj.so.3)
at 0x4031a820: gnu.java.rmi.registry.RegistryImpl_Stub.rebind(java.lang.String, java.rmi.Remote) (/usr/lib/./li
bgcj.so.3)
at 0x40315a42: java.rmi.Naming.rebind(java.lang.String, java.rmi.Remote) (/usr/lib/./libgcj.so.3)
at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
at 0x402306e8: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
at 0x40230ff4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3
)
at 0x4022e504: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/./libgcj.so.3)
at 0x4038305c: ?? (??:0)
at 0x40242dd8: gnu.gcj.runtime.FirstThread.call_main() (/usr/lib/./libgcj.so.3)
at 0x402ad02d: gnu.gcj.runtime.FirstThread.run() (/usr/lib/./libgcj.so.3)
at 0x4024fc4c: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/./libgcj.so.3)
at 0x4021c8ac: _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/./libgcj.so.3)
at 0x08048910: ?? (??:0)
at 0x42015574: __libc_start_main (/lib/tls/libc.so.6)
at 0x080486c1: ?? (??:0)
java.net.UnknownHostException:
at 0x40268e17: java.lang.Throwable.Throwable(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x4025bcd2: java.lang.Exception.Exception(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x4026fbce: java.io.IOException.IOException(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x402f3d2a: java.net.UnknownHostException.UnknownHostException(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x40253f22: java.net.InetAddress.lookup(java.lang.String, java.net.InetAddress, boolean) (/usr/lib/./libgcj.
so.3)
at 0x402ed8ca: java.net.InetAddress.getByName(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x402ef323: java.net.Socket.Socket(java.lang.String, int) (/usr/lib/./libgcj.so.3)
at 0x40320b96: gnu.java.rmi.server.RMIDefaultSocketFactory.createSocket(java.lang.String, int) (/usr/lib/./libg
cj.so.3)
at 0x40321753: gnu.java.rmi.server.UnicastConnectionManager.getClientConnection() (/usr/lib/./libgcj.so.3)
at 0x403216a4: gnu.java.rmi.server.UnicastConnectionManager.getConnection() (/usr/lib/./libgcj.so.3)
at 0x40321adc: gnu.java.rmi.server.UnicastRef.invokeCommon(java.rmi.Remote, java.lang.reflect.Method, java.lang
.Object[], int, long) (/usr/lib/./libgcj.so.3)

Any Help would be Appreciated
Naty!!!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to specify the server name in the naming call and see if this affects anything - try things like -



If this is the case, it could be a problem with how your hosts file is set up...

Also, have you tried to run the code normally, or only compiled in GCJ?
[ September 22, 2005: Message edited by: Nathan Pruett ]
 
Naty wills
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate,
Now code is running.

Naty
 
Naty wills
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate,
Now code is running.

Naty
 
Naty wills
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate.
Code is running now..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!