Re: multiple services in one vm?

Gregg Wonderly <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Rikard Elofsson wrote:
> Then I start my server service and export (via JERI) and register it and
> use a JoinManager to see that it actually registers. This all works fine
> and i get a nice log:
>
> INFO: started Reggie: 85706c25-4a28-43a7-b533-224f4900f3a6, [],
> ConstrainableLookupLocator[[jini://192.168.0.12/], [null]]
> RemoteLogServer discovered by
> net.jini.discovery.LookupDiscoveryManager@15c97e4

This is an expected log entry from the service starter framework.

> Then I try to find my service:
>
> LookupDiscoveryManager mgr = new
> LookupDiscoveryManager(LookupDiscovery.ALL_GROUPS, null, null);

As Vinod said, this creates a mechanism for finding instances of
ServiceRegistrar (probably Reggie since that is what you started).  There are
two null arguments passed here which basically make this a useless object
because you won't see anything that it finds without passing in or adding a
DiscoveryListener.

As Vinod said, a ServiceDiscoveryManager might be a better choice on a local
network.  SDM requires callbacks to work, so if your clients are not on the same
routable network as the services, then clients can't use SDM.  Instead, you
should use LookupDiscoveryManager, but add the use of a DiscoveryListener and
create code and logic to process the returned registrars and call lookup on them.

> When I run this all hell breaks loose in the log. Copying it below (much
> longer on my screen) What is my problem?

The log output that you see is exactly what is expected because of the log
levels being turned up very high.  The default J2SE Formatter creates output
that is very hard for me to understand because it creates multiline output, and
doesn't tell you what logger is generating all the noise so that you can turn it
down.

I've just submitted an update to the http://startnow.dev.java.net project to
include an updated version of the org.wonderly.log.StreamFormatter class.  You
might try adding that do your logging configuration with

java.util.logging.ConsoleHandler.formatter=org.wonderly.log.StreamFormatter

and then adding startnow.jar to your service classpath.  The output of the
logging might be easier for you to sift through.

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 [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.