Discussion:
Working with the class server
Asaf Lahav
2008-08-03 14:14:51 UTC
Permalink
I need some clarification on how to employ the class server.

I have a couple of jvm's. one writing entries and the other taking them.

The entry class I'm using is very simple:



import net.jini.entry.AbstractEntry;

public class JavaspaceTaggingEntry extends AbstractEntry{

private static final long serialVersionUID =
-1559963129857857100L;

public String myName = null;

}



The writer jvm, naturally has the entry class definitions in its class path.
The taker doesn't.

I tried putting the entry jar into the lib-dl folder under the jinni started
kit and made sure the Class Server server points to it so it would be
available through it.

The problem is that when I attempt to take the entry, I got a class not
found exception.



What is the right way to employ the class server?












--------------------------------------------------------------------------
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 ***@java.sun.com
Guy Korland
2008-08-03 19:10:03 UTC
Permalink
Hi Asaf,



In general what you need to do is to set a Codebase server.

BTW, in Gigaspaces we found out that setting such server is not scalable
and in fact many times acts as a single point of failure.

So, what we developed (which is also available as part of our community
free addition) is a dynamic class loader.



Once the space stores an instance of an Entry (or an Entry's field) the
class is dynamically stored in the space and seamlessly provided to the
"taker" when needed.



GUy



________________________________

From: Asaf Lahav [mailto:***@GMAIL.COM]
Sent: Sunday, August 03, 2008 5:15 PM
To: JINI-***@JAVA.SUN.COM
Subject: Working with the class server



I need some clarification on how to employ the class server.

I have a couple of jvm's. one writing entries and the other taking them.

The entry class I'm using is very simple:



import net.jini.entry.AbstractEntry;

public class JavaspaceTaggingEntry extends AbstractEntry{

private static final long serialVersionUID =
-1559963129857857100L;

public String myName = null;

}



The writer jvm, naturally has the entry class definitions in its class
path. The taker doesn't.

I tried putting the entry jar into the lib-dl folder under the jinni
started kit and made sure the Class Server server points to it so it
would be available through it.

The problem is that when I attempt to take the entry, I got a class not
found exception.



What is the right way to employ the class server?











------------------------------------------------------------------------
-- 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 ***@java.sun.com

--------------------------------------------------------------------------
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 ***@java.sun.com
Dennis Reedy
2008-08-03 23:46:11 UTC
Permalink
Perhaps you can check to ensure your writer JVM has defined a codebase
that can serve the jars in question. This is most likely the issue you
are encountering.

HTH

Dennis


On Aug 3, 2008, at 310PM, Guy Korland wrote:

> Hi Asaf,
>
> In general what you need to do is to set a Codebase server.
> BTW, in Gigaspaces we found out that setting such server is not
> scalable and in fact many times acts as a single point of failure.
> So, what we developed (which is also available as part of our
> community free addition) is a dynamic class loader.
>
> Once the space stores an instance of an Entry (or an Entry's field)
> the class is dynamically stored in the space and seamlessly provided
> to the "taker" when needed.
>
> GUy
>
> From: Asaf Lahav [mailto:***@GMAIL.COM]
> Sent: Sunday, August 03, 2008 5:15 PM
> To: JINI-***@JAVA.SUN.COM
> Subject: Working with the class server
>
> I need some clarification on how to employ the class server.
> I have a couple of jvm's. one writing entries and the other taking
> them.
> The entry class I'm using is very simple:
>
> import net.jini.entry.AbstractEntry;
> public class JavaspaceTaggingEntry extends AbstractEntry{
> private static final long serialVersionUID =
> -1559963129857857100L;
> public String myName = null;
> }
>
> The writer jvm, naturally has the entry class definitions in its
> class path. The taker doesn't.
> I tried putting the entry jar into the lib-dl folder under the jinni
> started kit and made sure the Class Server server points to it so it
> would be available through it.
> The problem is that when I attempt to take the entry, I got a class
> not found exception.
>
> What is the right way to employ the class server?
>
>
>
>
>
> -------------------------------------------------------------------------- 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" ***@java.sun.com
> -------------------------------------------------------------------------- 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 ***@java.sun.com


--------------------------------------------------------------------------
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 ***@java.sun.com
Asaf Lahav
2008-08-04 08:14:24 UTC
Permalink
I also tried putting the entries jar on the lib folder of the installverify
jvm.

Yet, I get the following exception when I tried to add the entry as lookup
attributed of the java space.



java.rmi.ServerException: RemoteException in server thread; nested exception
is:

java.rmi.UnmarshalException: unmarshalling method/arguments; nested
exception is:

java.lang.ClassNotFoundException:
jini.javaspace.testing.entries.JavaspaceTaggingEntry







From: Dennis Reedy [mailto:***@GMAIL.COM]
Sent: Monday, August 04, 2008 2:46 AM
To: JINI-***@JAVA.SUN.COM
Subject: Re: Working with the class server



Perhaps you can check to ensure your writer JVM has defined a codebase that
can serve the jars in question. This is most likely the issue you are
encountering.



HTH



Dennis





On Aug 3, 2008, at 310PM, Guy Korland wrote:



Hi Asaf,



In general what you need to do is to set a Codebase server.

BTW, in Gigaspaces we found out that setting such server is not scalable and
in fact many times acts as a single point of failure.

So, what we developed (which is also available as part of our community free
addition) is a dynamic class loader.



Once the space stores an instance of an Entry (or an Entry's field) the
class is dynamically stored in the space and seamlessly provided to the
"taker" when needed.



GUy



_____

From: Asaf Lahav [ <mailto:***@GMAIL.COM>
mailto:***@GMAIL.COM]
Sent: Sunday, August 03, 2008 5:15 PM
To: <mailto:JINI-***@JAVA.SUN.COM> JINI-***@JAVA.SUN.COM
Subject: Working with the class server



I need some clarification on how to employ the class server.

I have a couple of jvm's. one writing entries and the other taking them.

The entry class I'm using is very simple:



import net.jini.entry.AbstractEntry;

public class JavaspaceTaggingEntry extends AbstractEntry{

private static final long serialVersionUID =
-1559963129857857100L;

public String myName = null;

}



The writer jvm, naturally has the entry class definitions in its class path.
The taker doesn't.

I tried putting the entry jar into the lib-dl folder under the jinni started
kit and made sure the Class Server server points to it so it would be
available through it.

The problem is that when I attempt to take the entry, I got a class not
found exception.



What is the right way to employ the class server?











--------------------------------------------------------------------------
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" ***@java.sun.com
--------------------------------------------------------------------------
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 ***@java.sun.com



--------------------------------------------------------------------------
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 ***@java.sun.com


--------------------------------------------------------------------------
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 ***@java.sun.com
Guy Korland
2008-08-04 09:08:54 UTC
Permalink
The problem with codebase, as I wrote before, is that if the Writer
leaves/fails then the data in the space can't be read/take by any other
user.



Guy



________________________________

From: Dennis Reedy [mailto:***@GMAIL.COM]
Sent: Monday, August 04, 2008 2:46 AM
To: JINI-***@JAVA.SUN.COM
Subject: Re: Working with the class server



Perhaps you can check to ensure your writer JVM has defined a codebase
that can serve the jars in question. This is most likely the issue you
are encountering.



HTH



Dennis





On Aug 3, 2008, at 310PM, Guy Korland wrote:





Hi Asaf,



In general what you need to do is to set a Codebase server.

BTW, in Gigaspaces we found out that setting such server is not scalable
and in fact many times acts as a single point of failure.

So, what we developed (which is also available as part of our community
free addition) is a dynamic class loader.



Once the space stores an instance of an Entry (or an Entry's field) the
class is dynamically stored in the space and seamlessly provided to the
"taker" when needed.



GUy



________________________________

From: Asaf Lahav [mailto:***@GMAIL.COM
<mailto:***@GMAIL.COM> ]
Sent: Sunday, August 03, 2008 5:15 PM
To: JINI-***@JAVA.SUN.COM <mailto:JINI-***@JAVA.SUN.COM>
Subject: Working with the class server



I need some clarification on how to employ the class server.

I have a couple of jvm's. one writing entries and the other taking them.

The entry class I'm using is very simple:



import net.jini.entry.AbstractEntry;

public class JavaspaceTaggingEntry extends AbstractEntry{

private static final long serialVersionUID =
-1559963129857857100L;

public String myName = null;

}



The writer jvm, naturally has the entry class definitions in its class
path. The taker doesn't.

I tried putting the entry jar into the lib-dl folder under the jinni
started kit and made sure the Class Server server points to it so it
would be available through it.

The problem is that when I attempt to take the entry, I got a class not
found exception.



What is the right way to employ the class server?











------------------------------------------------------------------------
-- 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" ***@java.sun.com
------------------------------------------------------------------------
-- 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 ***@java.sun.com



------------------------------------------------------------------------
-- 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 ***@java.sun.com

--------------------------------------------------------------------------
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 ***@java.sun.com
Dennis Reedy
2008-08-04 11:17:58 UTC
Permalink
Why do you say that? If the writer leaves then the entries written
will eventually be removed when their leases expire. The writer's
codebase does not have to be coupled with the writer itself.

HTH

Dennis

On Aug 4, 2008, at 508AM, Guy Korland wrote:

> The problem with codebase, as I wrote before, is that if the Writer
> leaves/fails then the data in the space can't be read/take by any
> other user.
>
> Guy
>
> From: Dennis Reedy [mailto:***@GMAIL.COM]
> Sent: Monday, August 04, 2008 2:46 AM
> To: JINI-***@JAVA.SUN.COM
> Subject: Re: Working with the class server
>
> Perhaps you can check to ensure your writer JVM has defined a
> codebase that can serve the jars in question. This is most likely
> the issue you are encountering.
>
> HTH
>
> Dennis
>
>
> On Aug 3, 2008, at 310PM, Guy Korland wrote:
>
>
> Hi Asaf,
>
> In general what you need to do is to set a Codebase server.
> BTW, in Gigaspaces we found out that setting such server is not
> scalable and in fact many times acts as a single point of failure.
> So, what we developed (which is also available as part of our
> community free addition) is a dynamic class loader.
>
> Once the space stores an instance of an Entry (or an Entry's field)
> the class is dynamically stored in the space and seamlessly provided
> to the "taker" when needed.
>
> GUy
>
> From: Asaf Lahav [mailto:***@GMAIL.COM]
> Sent: Sunday, August 03, 2008 5:15 PM
> To: JINI-***@JAVA.SUN.COM
> Subject: Working with the class server
>
> I need some clarification on how to employ the class server.
> I have a couple of jvm's. one writing entries and the other taking
> them.
> The entry class I'm using is very simple:
>
> import net.jini.entry.AbstractEntry;
> public class JavaspaceTaggingEntry extends AbstractEntry{
> private static final long serialVersionUID =
> -1559963129857857100L;
> public String myName = null;
> }
>
> The writer jvm, naturally has the entry class definitions in its
> class path. The taker doesn't.
> I tried putting the entry jar into the lib-dl folder under the jinni
> started kit and made sure the Class Server server points to it so it
> would be available through it.
> The problem is that when I attempt to take the entry, I got a class
> not found exception.
>
> What is the right way to employ the class server?
>
>
>
>
>
> -------------------------------------------------------------------------- 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" ***@java.sun.com
> -------------------------------------------------------------------------- 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 ***@java.sun.com
>
> -------------------------------------------------------------------------- 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 ***@java.sun.com


--------------------------------------------------------------------------
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 ***@java.sun.com
Asaf Lahav
2008-08-04 08:58:22 UTC
Permalink
Ok, got it. my bad.

The installverify class path is not designed to look at the lib folder as
its own class path.

Now it works fine.



Thanks



From: Asaf Lahav [mailto:***@gmail.com]
Sent: Monday, August 04, 2008 11:14 AM
To: 'JINI-***@JAVA.SUN.COM'
Subject: RE: Working with the class server



I also tried putting the entries jar on the lib folder of the installverify
jvm.

Yet, I get the following exception when I tried to add the entry as lookup
attributed of the java space.



java.rmi.ServerException: RemoteException in server thread; nested exception
is:

java.rmi.UnmarshalException: unmarshalling method/arguments; nested
exception is:

java.lang.ClassNotFoundException:
jini.javaspace.testing.entries.JavaspaceTaggingEntry







From: Dennis Reedy [mailto:***@GMAIL.COM]
Sent: Monday, August 04, 2008 2:46 AM
To: JINI-***@JAVA.SUN.COM
Subject: Re: Working with the class server



Perhaps you can check to ensure your writer JVM has defined a codebase that
can serve the jars in question. This is most likely the issue you are
encountering.



HTH



Dennis





On Aug 3, 2008, at 310PM, Guy Korland wrote:



Hi Asaf,



In general what you need to do is to set a Codebase server.

BTW, in Gigaspaces we found out that setting such server is not scalable and
in fact many times acts as a single point of failure.

So, what we developed (which is also available as part of our community free
addition) is a dynamic class loader.



Once the space stores an instance of an Entry (or an Entry's field) the
class is dynamically stored in the space and seamlessly provided to the
"taker" when needed.



GUy



_____

From: Asaf Lahav [ <mailto:***@GMAIL.COM>
mailto:***@GMAIL.COM]
Sent: Sunday, August 03, 2008 5:15 PM
To: <mailto:JINI-***@JAVA.SUN.COM> JINI-***@JAVA.SUN.COM
Subject: Working with the class server



I need some clarification on how to employ the class server.

I have a couple of jvm's. one writing entries and the other taking them.

The entry class I'm using is very simple:



import net.jini.entry.AbstractEntry;

public class JavaspaceTaggingEntry extends AbstractEntry{

private static final long serialVersionUID =
-1559963129857857100L;

public String myName = null;

}



The writer jvm, naturally has the entry class definitions in its class path.
The taker doesn't.

I tried putting the entry jar into the lib-dl folder under the jinni started
kit and made sure the Class Server server points to it so it would be
available through it.

The problem is that when I attempt to take the entry, I got a class not
found exception.



What is the right way to employ the class server?











--------------------------------------------------------------------------
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" ***@java.sun.com
--------------------------------------------------------------------------
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 ***@java.sun.com



--------------------------------------------------------------------------
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 ***@java.sun.com


--------------------------------------------------------------------------
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 ***@java.sun.com
Gregg Wonderly
2008-08-04 15:20:23 UTC
Permalink
Asaf Lahav wrote:
> Ok, got it… my bad.
>
> The installverify class path is not designed to look at the lib folder
> as its own class path.
>
> Now it works fine.

Putting jar files in everyones classpath, is NOT what Jini was designed to do.
That creates versioning nightmares. Everytime you need to update something,
everyone has to get the new version and install it. The Java mobile code model,
first visible in RMI, and carried forward (and greatly enhanced in Jini), allows
clients to get the "right" version of the software they need, automatically.
The term "codebase" is used to describe the jar file(s) needed to resolve
classes which are downloaded (as opposed to those in your classpath, that are on
the disk locally, always).

Things that will be in the classpath, are things like interface definitions, and
core classes (such as abstract classes) which do not change, or do so rarely,
and typically in Serialization Spec compatible ways. In RMI, you had to set the
system property, java.rmi.server.codebase on the command line. You'd typically
do something like

java -Djava.rmi.server.codebase=http://mycode.server.domain/my.jar

to tell RMI what to "annotate" mobile, serialized code with so that the receiver
could find out how to download the code. The RMIClassLoaderSPI class's javadocs
provide some information on how this works.

With Jini, this mechanism is plugged into using the PerferredClassLoader. The
service starter framework (the classes in com.sun.jini.start) provide a
"Configuration" based mechanism for detailing the classpath, codebase, security
policy, command line arguments and service "class" using the ServiceDescriptor
based classes.

It is in that place, that you usually need to put the specification of your
codebase for the code that is putting entries into a Javaspace. As Guy said, if
you have long lived entries, you need to manage the fact that the codebase URLs
need to work for all clients at all times that you need them too. As Dennis
responded, short lived entries, will expire if the writer stops renewing leases.

The gigaspaces Javaspace implementation has an "in place class server" that is
part of the space implementation. When you write something, the annotation is
used to download the specified jars into the space, and the entries are modified
to indicate a different way to get the code to resolve the classes inside them.

This is an interesting capability, but it doesn't resolve all entries associated
with some desired behaviors when an entries' codebase server disappears.

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 ***@java.sun.com
Continue reading on narkive:
Loading...