The Artima Developer Community
Sponsored Link

Legacy Jini Forum
The Jini Lookup Service



This page contains an archived post to the Jini Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Method Calls from Registered Service

Posted by Jay on May 18, 2001 at 8:32 PM


I am able to bring up http, rmid, reggie...register a service
and discover the service, get an object from the lookup, but
when I execute a method from the object, I get the following error. One thing I must mention is that I am running everything
on the same machine.

(I have replaced my actual IP with for this question)

.all -classpath .;C:\files\jini1_1\lib\jini-core.jar;C:\files\jini1_1\lib\jini-
ext.jar;C:\files\jini1_1\lib\sun-util.jar AddClient
client: ServiceRegistrar = com.sun.jini.reggie.RegistrarProxy@f2e7a27f
client: ServiceID = 2c1e2bbc-bf1b-4a49-8415-fe82e5f73d08
MyServer: ServiceMatches = net.jini.core.lookup.ServiceMatches@f73c1
MyServer: num matches = 1
MyServer: svc item 0: net.jini.core.lookup.ServiceItem@5ee671
MyServer: svc object 0: AddServiceImpl_Stub[RemoteStub [ref: [endpoint:[](remote),objID:[30c221:e68e0c0f74:-8000, 0]]]]
Object is: AddServiceImpl_Stub[RemoteStub [ref: [endpoint:[](r
emote),objID:[30c221:e68e0c0f74:-8000, 0]]]]
Exception in thread "main" java.rmi.ConnectException: Connection refused to host
:; nested exception is: Connection refused: connect Connection refused: connect
at Method)
at Source)
at Source)
at Source)
at Source)
at Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
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.invoke(Unknown Source)
at AddServiceImpl_Stub.add(Unknown Source)
at AddClient.main(


Here is the client code:

public static void main(String[] args) throws Exception {

System.setSecurityManager( new RMISecurityManager());

LookupLocator lookUp = new LookupLocator("jini://");

ServiceRegistrar registrar = lookUp.getRegistrar();

ServiceID id = registrar.getServiceID();

System.out.println ("client: ServiceRegistrar = " + registrar);

System.out.println ("client: ServiceID = " + id);

Entry[] attributes = new Entry[1];
attributes[0] = new Name("Add Service");

ServiceMatches matches = registrar.lookup(new ServiceTemplate (null, null, attributes),50);
System.out.println ("MyServer: ServiceMatches = " + matches);
System.out.println ("MyServer: num matches = "+ matches.totalMatches);
for (int i = 0; i < matches.totalMatches; i++) {
System.out.println ("MyServer: svc item " + i + ": " + matches.items[i]);
System.out.println ("MyServer: svc object " + i + ": " + matches.items[i].service);

ServiceItem item = (ServiceItem)matches.items[0];

AddService proxy = (AddService)item.service;

System.out.println("Object is: " + proxy.toString());

String z = proxy.add("Hello","World");

System.out.println ("Result is: " + z + "\n");

The http server shows that the stub and implementation are being
requested..but I don't see them loaded into the directory my client is running from. Should I see it?

Any help would be appreciated.

  • same problem Ruddi December 27, 2001 at 8:41 AM (0)
  • problem Kevin Woods December 11, 2001 at 9:52 AM (0)

Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us