user1919
user1919

Reputation: 3938

java.rmi.ConnectException: Connection refused to host 192.168.56.1

I try to install an opensource software on a Windows8 system using command prompt. I have never done something similar before and I am not very experienced using RMI. I need some help with the exception errors I get. This is the procedure I follow:

I have set a CLASSPATH like this

  set CLASSPATH=C:\kuwaiba7\service\lib\PersistenceAbstractionAPI.jar;C:\kuwaiba7\service\lib\PersistenceServiceRemoteInterfaces.jar 

Then I start the RMI registry:

  start "C:\Program Files\Java\jdk1.7.0_71\bin\rmiregistry.exe

A new command prompt windows opens. In this window I run the following command for the PersistenceService:

  C:\kuwaiba7\service>java -Djava.rmi.server.codebase="file:/C:/kuwaiba7/service/l
ib/PersistenceAbstractionAPI.jar file:/C:/kuwaiba7/service/lib/PersistenceServiceRemoteInterfaces.jar" -jar PersistenceService.jar

The first lines show that the connection to the database is established but then I get a: java.rmi.ConnectException error.

  [Sun Nov 23 13:57:02 EET 2014] Current working directory: C:\kuwaiba7\service
  [Sun Nov 23 13:57:02 EET 2014] Establishing connection to the database...
  [Sun Nov 23 13:57:03 EET 2014] Connection established
  EmbeddedGraphDatabase [C:\kuwaiba7\service\target\kuwaiba.db]
  [Sun Nov 23 13:57:04 EET 2014] Registry obtained
  java.rmi.ConnectException: Connection refused to host: 192.168.56.1; nested exception is:
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
    at sun.rmi.server.UnicastRef.newCall(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at org.kuwaiba.persistenceservice.Main.main(Main.java:72)
 Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
    ... 6 more
    [Sun Nov 23 13:57:05 EET 2014] Abnormal program termination. See log file for  details

My questions are: 1) How can I be sure that the RMI is running correctly? 2) Does this exception I get means that my RMI doesn't run? 3) How can I solve this exception error in the command prompt?

I also want to mention that before setting the classpath I was getting another error: java.rmi.serverException java.rmi.unmarshalException java.lang.classNotFoundException

After setting the classpath, I stopped getting these errors.

I would appreaciate any help on this. As I mentioned I am not very experienced working with the RMI so please be patient! :)

Thanks Dimitris

Upvotes: 0

Views: 1723

Answers (1)

user1919
user1919

Reputation: 3938

I was starting and then stopping the Registry by using the command prompt window, which had opened for the registry. EJP in his above comment explained it very clearly. Thanks.

Upvotes: 2

Related Questions