Uncatchable exception in LookupLocatorDiscovery.

View: New views
2 Messages — Rating Filter:   Alert me  

Uncatchable exception in LookupLocatorDiscovery.

by Rawlings, Bill A :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Nice to see all the discussion going on about River.  However, some of us are still wrestling with the code.

 

I’m trying to develop an administration app.  I want to be able to see if a LUS is running on a particular machine.

 

I’m using the LookupLocatorDiscovery class…

 

    try

    {

      LookupLocator[] locs = new LookupLocator[] {new LookupLocator("jini://localhost/")};

      LookupLocatorDiscovery lld = new LookupLocatorDiscovery(locs);

      lld.addDiscoveryListener(this);

    }

    catch(Exception ex)

    {

     System.out.println(“Error discovering LUS”);

      ex.printStackTrace();

    }

 

If there is NOT a LUS running on “localhost”, I get this:

 

Dec 15, 2008 8:35:17 AM net.jini.discovery.LookupLocatorDiscovery$LocatorReg tryGetProxy

INFO: exception occured during unicast discovery to xxx.xx.xx.xxx:4160 with constraints InvocationConstraints[reqs: {}, prefs: {}]

java.net.ConnectException: Connection refused: connect

                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:516)

                at java.net.Socket.connect(Socket.java:466)

                at com.sun.jini.discovery.internal.MultiIPDiscovery.getSingleResponse(MultiIPDiscovery.java:134)

                at com.sun.jini.discovery.internal.MultiIPDiscovery.getResponse(MultiIPDiscovery.java:83)

                at net.jini.discovery.LookupLocatorDiscovery$LocatorReg.doUnicastDiscovery(LookupLocatorDiscovery.java:505)

                at net.jini.discovery.LookupLocatorDiscovery$LocatorReg.tryGetProxy(LookupLocatorDiscovery.java:474)

                at net.jini.discovery.LookupLocatorDiscovery.regTryGetProxy(LookupLocatorDiscovery.java:1271)

                at net.jini.discovery.LookupLocatorDiscovery.access$800(LookupLocatorDiscovery.java:308)

                at net.jini.discovery.LookupLocatorDiscovery$DiscoveryTask.tryOnce(LookupLocatorDiscovery.java:703)

                at com.sun.jini.thread.RetryTask.run(RetryTask.java:131)

                at com.sun.jini.thread.TaskManager$TaskThread.run(TaskManager.java:331)

It doesn’t get caught in that try/catch block.  It doesn’t get caught if I try to catch “Throwable” instead of “Exception”, it doesn’t get caught if I throw it out of the method and try to catch it in the calling block.

 

Is there a better way of determining if a LUS is running on a particular machine?  If I could catch the exception, I could “conclude” there is no LUS, but I can’t catch it.

 

Bill

-------------------------------------------------------------------------- Getting Started: http://www.jini.org/wiki/Category:Getting_Started Community Web Site: http://jini.org jini-users Archive: http://archives.java.sun.com/archives/jini-users.html Unsubscribing: email "signoff JINI-USERS" to listserv@...

Re: Uncatchable exception in LookupLocatorDiscovery.

by Gregg Wonderly-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Rawlings, Bill A wrote:
> Nice to see all the discussion going on about River.  However, some of
> us are still wrestling with the code.
>
>  
>
> I’m trying to develop an administration app.  I want to be able to see
> if a LUS is running on a particular machine.

LookupLocator.getRegistrar() is all you need Bill.  If there is a lookup service
running, that will return the proxy, otherwise you will get an appropriate
exception.

Gregg Wonderly

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...