Re: working across 2 servers/using clients - some basic questions

"John McClain - Sun Microsystems, Inc." <[email protected]> Fri, 18 Aug 2006 13:20:25 -0400
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
steve kirby wrote:
> Hi,
>
> I am able to write an entry to a java space and have notify() tell me it
> arrived, all on the same server.  But I have to admit, this is not
> terribly exciting......................
>
> So to get the true capability out of java spaces, I would like to
> communicate across 2 or more servers and/or introduce clients. This is
> where the beauty of the loose-coupling comes in.
>
> For example, I would like to write an entry into javaspaceA on serverA,
> and then have a client running on serverB, running notify(), be notified
> of this new entry in javaspaceA.  Is this paradigm right?
>
> What I'm not clear on is how can the client, running on a different
> server (serverB), discover that there is a javaspaceA out there - this
> is where reggie and outrigger come in but I'm not clear on how to set
> things up, i.e., the args for the codebase.
>
> Any info would be a big help.

To first order I would expect all clients to find the space the same
way. So if the client doing the writing found the space by discovering
lookups in the "skirby" group and then looking for services that
implement the net.jini.space.JavaSpace interface, I would expect the
client running on serverB to find lookups in the "skirby" group and then
looking for services that implement the net.jini.space.JavaSpace interface.

Hard to give specific adivce w/o knowing how the first client is
discovering the space and how the space is configured, but there are a
few things that might keep this from working, the ones that come
immediately to mind are:

   The space's codebase starts with "http://localhost" or "file:/", the
   right thing(TM) to do in that case is change the space's codebase to a
   URL that is location indepent (eg. an http URL with a resolvable host
   name in it or an IP address)

   The space has no codebase at all, the only reason the first client
   can access it is because it has outrigger-dl.jar in its classpath.
   You could "fix"  this by putting outrigger-dl.jar in the 2nd clients
   classpath, but it would be better to setup a real codebase.

   The first client is using unicast to discovery the lookup and is using
   a locator of the form jini://localhost. You could either switch to
   multicast discovery or have the 2nd client use unicast, but with
   a locator that has a hostname (or IP address) instead of "localhost".

Hope this helps, if not I can try again.

--
John McClain                                    [email protected]
Sun Microsystems, Inc.
Burlington, MA

And it is that way today. We are tricked by hope into starting
companies, beginning books, immigrating to this country and investing
in telecom networks. The challenges turn out to be tougher than we
imagined. Our excessive optimism is exposed. New skills are demanded.
But nothing important was ever begun in a prudential frame of mind.

         - David Brooks

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html