1

Sample of the code:

    ServiceTemplate tmp1 = new ServiceTemplate(null, classes, null);

    try {

    /*      if(System.getSecurityManager() == null)

            System.setSecurityManager(new RMISecurityManager());*/

        thisIp = InetAddress.getLocalHost();
        LookupLocator locator = new LookupLocator("jini://"+thisIp.getHostName().toString());
        ServiceRegistrar sr = locator.getRegistrar();
        JavaSpace space = (JavaSpace)sr.lookup(tmp1);
        System.out.println("Success");

    } 

Encountering error at [ ServiceRegistrar sr = locator.getRegistrar();] which states

java.net.ConnectException: Connection refused
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:209)
at net.jini.core.discovery.LookupLocator.getRegistrar(LookupLocator.java:328)
at net.jini.core.discovery.LookupLocator.getRegistrar(LookupLocator.java:286)
at MessageEntry.main(MessageEntry.java:34)

I am new to JavaSpace tech, kindly assist me.

Thank You in Advance

Jeetesh.N

Иван Бишевац
  • 12,001
  • 20
  • 60
  • 88
Jeetesh Nataraj
  • 578
  • 1
  • 7
  • 19
  • Did you started services? How you did that? From which source, from Apache River, Blitz, or Gigaspaces? Give more info about problem. – Иван Бишевац Dec 15 '11 at 14:20
  • @Иван Бишевац: The code courtesy was from gigaspaces from http://www.gigaspaces.com/wiki/display/XAP7/Plain+JavaSpaces+Tutorial#PlainJavaSpacesTutorial-1. – Jeetesh Nataraj Dec 16 '11 at 04:49

1 Answers1

2

The ConnectException is a quite fundamental error which simply means that your Java process could not establish a socket connection to the target machine and port, because that machine wasn't accepting connections on the target port. In this case it's almost certainly trying to connect to your localhost IP address using the default JINI port.

I'd suggest that this error means you don't have a JINI service/registrar running on your machine at the time you executed the code.

Andrzej Doyle
  • 97,637
  • 30
  • 185
  • 225