Adding an attribute to the javaspace05 service instance

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

Adding an attribute to the javaspace05 service instance

by Asaf Lahav-2 :: 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.

Hi All,

I would like to add additional Attributes to the javaspaces05 service automatically from a remote client.

For that purpose, I created my own Entry implementation:

import java.util.Date;

import net.jini.entry.AbstractEntry;

public class MyEntry extends AbstractEntry {

      private static final long serialVersionUID = -3131394991217559764L;

     

      public String myName = null;

      public Date birthDate = null;

      public MyEntry() {

      }

}

 

The problem is that when I attempt to add this attribute to the service (using the joinAdmin), I'm getting the following exception:

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

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

      java.lang.ClassNotFoundException: infrastructure.jini.discovery.service.entries.MyEntry

      at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:644)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597)

      at net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568)

      at com.sun.jini.start.AggregatePolicyProvider$6.run(AggregatePolicyProvider.java:527)

      at java.security.AccessController.doPrivileged(Native Method)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778)

      at net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148)

      at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244)

      at com.sun.jini.start.AggregatePolicyProvider$5.run(AggregatePolicyProvider.java:513)

      at java.security.AccessController.doPrivileged(Native Method)

      at com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241)

      at com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136)

      at java.lang.Thread.run(Thread.java:595)

      at com.sun.jini.jeri.internal.runtime.Util.__________EXCEPTION_RECEIVED_FROM_SERVER__________(Util.java:108)

      at com.sun.jini.jeri.internal.runtime.Util.exceptionReceivedFromServer(Util.java:101)

      at net.jini.jeri.BasicInvocationHandler.unmarshalThrow(BasicInvocationHandler.java:1303)

      at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:832)

      at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandler.java:659)

      at net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:528)

      at com.sun.jini.outrigger.$Proxy1.addLookupAttributes(Unknown Source)

      at com.sun.jini.outrigger.AdminProxy.addLookupAttributes(AdminProxy.java:132)

      at infrastructure.jini.discovery.RegistrarQueryHelper.addServiceFields(RegistrarQueryHelper.java:57)

      at infrastructure.jini.discovery.activators.Activator.start(Activator.java:49)

      at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:991)

      at java.security.AccessController.doPrivileged(Native Method)

      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:985)

      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:966)

      at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:317)

      at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:329)

      at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1046)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:573)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:495)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:275)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:455)

      at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:189)

      at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:291)

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

      java.lang.ClassNotFoundException: infrastructure.jini.discovery.service.entries.MyEntry

      at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:619)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597)

      at net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568)

      at com.sun.jini.start.AggregatePolicyProvider$6.run(AggregatePolicyProvider.java:527)

      at java.security.AccessController.doPrivileged(Native Method)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540)

      at com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778)

      at net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148)

      at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244)

      at com.sun.jini.start.AggregatePolicyProvider$5.run(AggregatePolicyProvider.java:513)

      at java.security.AccessController.doPrivileged(Native Method)

      at com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241)

      at com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136)

      at java.lang.Thread.run(Thread.java:595)

Caused by: java.lang.ClassNotFoundException: infrastructure.jini.discovery.service.entries.MyEntry

      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

      at java.security.AccessController.doPrivileged(Native Method)

      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

      at net.jini.loader.pref.PreferredClassLoader.loadClass(PreferredClassLoader.java:922)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

      at java.lang.Class.forName0(Native Method)

      at java.lang.Class.forName(Class.java:242)

      at net.jini.loader.pref.PreferredClassProvider.loadClass(PreferredClassProvider.java:613)

      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)

      at net.jini.loader.ClassLoading.loadClass(ClassLoading.java:138)

      at net.jini.io.MarshalInputStream.resolveClass(MarshalInputStream.java:296)

      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)

      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)

      at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1628)

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1293)

      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)

      at com.sun.jini.jeri.internal.runtime.Util.unmarshalValue(Util.java:221)

      at net.jini.jeri.BasicInvocationDispatcher.unmarshalArguments(BasicInvocationDispatcher.java:1049)

      at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:599)

      ... 17 more

 

 

Where should I place the jar with the class definition of MyEntry so that the jini server would be able to get its definition (I'm not interested in using the code download feature. I would rather install it somewhere on the server statically)?

Thanks in advance,

Asaf

 

-------------------------------------------------------------------------- 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: Adding an attribute to the javaspace05 service instance

by Gregg Wonderly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Asaf Lahav wrote:
> *Where should I place the jar with the class definition of MyEntry so
> that the jini server would be able to get its definition (I'm not
> interested in using the code download feature. I would rather install it
> somewhere on the server statically)?*

It simply a matter of including the jar in EVERYONEs classpath.  It's not just
the service who has that attribute that needs it.  Everyone that downloads the
services registration attributes from the lookup service will need it too.
Putting it out on a web server, and then having the client that adds it, resolve
it correctly two such a classloader would be the way to make the code
downloading work.  Otherwise, every client of this service will need it in their
classpath.

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