The Artima Developer Community
Sponsored Link

Legacy Jini Forum
The Jini Lookup Service

Advertisement

Advertisement

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.

Message:

problem

Posted by Kevin Woods on December 11, 2001 at 9:52 AM

> Hi,

> 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 11.11.11.11 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:[11.11.11.11:1413](remote),objID:[30c221:e68e0c0f74:-8000, 0]]]]
> Object is: AddServiceImpl_Stub[RemoteStub [ref: [endpoint:[11.11.11.11:1413](r
> emote),objID:[30c221:e68e0c0f74:-8000, 0]]]]
> Exception in thread "main" java.rmi.ConnectException: Connection refused to host
> : 11.11.11.11; nested exception is:
> java.net.ConnectException: Connection refused: connect
> java.net.ConnectException: Connection refused: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(Unknown Source)
> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> at java.net.PlainSocketImpl.connect(Unknown Source)
> at java.net.Socket.(Unknown Source)
> at java.net.Socket.(Unknown Source)
> at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
> ource)
> at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
> ource)
> 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(AddClient.java:60)

> C:\rmi\jiniclient\build>

> Here is the client code:

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

> System.setSecurityManager( new RMISecurityManager());

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

> 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.






Replies:

Sponsored Links



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