Re: Need help about code mobility

Dan Creswell <[email protected]>
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
Andrea Angeloni wrote:
> Hi, my first message in this mailing list.
>
> I'm a JavaSpaces newbie.
>
> I've runned, as my first JavaSpaces application, the prime number example
> founded at
> http://www.jroller.com/page/matsh?entry=intreagued_by_javaspaces_try_blitz
> (ant version). After installing Jini Starter Kit, and Blitz server, all ok,
> it runs correctly.
>

Phew, as I wrote Blitz, I'm pleased it all worked, otherwise I have some
debugging to do!

> During the study of JavaSpaces technology, I've found that is possible to
> use classes located remotely, in a web server for example, setting the
> codebase property of the java virtual machine that launches the processes,
> using the property
>
> -Djava.rmi.server.codebase=http://hostname/
>

Well, that's one way, yes.

> Now, I've tried  a test of this feature using prime example: I've removed
> the entry class (primejob.class) from the application folder, I've deployed
> it in my local web server (apache) under
> http://omino:8085/testjavaspace/  ,
> I've added the property in the ant build.xml file, for the producer and
> consumer processes, using
>
> <jvmarg
> value="-Djava.rmi.server.codebase=http://omino:8085/testjavaspace/"/>
>
> within the ant tasks.
>
>
> Running the producer process, I've the message  of PrimeJob class not
> found.
>

I'm not familiar with the example but I would imagine the producer
process has a direct dependency on PrimeJob in that it uses it's
constructor and fills in the fields.

With that being the case, setting java.rmi.server.codebase doesn't help
because that will be applied to _outgoing_ classes, not _incoming_ ones.

Thus PrimeJob needs to be in the Producer's classpath.  You can likely
get the client to download PrimeJob but you'll probably need to adjust
the code to not explicitly mention it in it's own code.

There are methods for modifying the Producer to not need PrimeJob in
it's classpath and download it across the net but if all you want to do
is see remote code loading at work, modifying the client side will be a
lot easier.

Hope that helps,

Dan.

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