Community
Participate
Working Groups
Build Identifier: 3.5.0 When using the Distributed Event Admin as described in the example here: http://wiki.eclipse.org/Distributed_EventAdmin_Service in conjunction with remote services (ecf.generic), I get a NotSerializableException when the event admin tries to send the IMPORT_SERVICE event. org.osgi.framework.ServiceException: send exception to target=null eventToSend=org.osgi.service.event.Event [topic=org/osgi/service/remoteserviceadmin/IMPORT_REGISTRATION] messageParams=null at org.eclipse.ecf.remoteservice.eventadmin.DistributedEventAdmin.handleSendMessageException(DistributedEventAdmin.java:304) at org.eclipse.ecf.remoteservice.eventadmin.DistributedEventAdmin.sendMessage(DistributedEventAdmin.java:209) at org.eclipse.ecf.remoteservice.eventadmin.DistributedEventAdmin.postEvent(DistributedEventAdmin.java:165) at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.postRemoteServiceAdminEvent(RemoteServiceAdmin.java:1088) at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.postEvent(RemoteServiceAdmin.java:986) at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.publishEvent(RemoteServiceAdmin.java:901) at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.publishImportEvent(RemoteServiceAdmin.java:1019) at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:309) Caused by: java.io.NotSerializableException: Cannot serialize property value of name=clientBundle.version and value=1.0.0.qualifier at org.eclipse.ecf.remoteservice.eventadmin.EventMessage.createPropertiesFromEvent(EventMessage.java:51) at org.eclipse.ecf.remoteservice.eventadmin.EventMessage.<init>(EventMessage.java:35) at org.eclipse.ecf.remoteservice.eventadmin.DistributedEventAdmin.createMessageDataFromEvent(DistributedEventAdmin.java:249) at org.eclipse.ecf.remoteservice.eventadmin.DistributedEventAdmin.sendMessage(DistributedEventAdmin.java:205) ... 21 more Am I doing something wrong? Reproducible: Always
From the stack trace provided...i.e. Caused by: java.io.NotSerializableException: Cannot serialize property value of name=clientBundle.version and value=1.0.0.qualifier at org.eclipse.ecf.remoteservice.eventadmin.EventMessage.createPropertiesFromEvent(EventMessage.java:51) at org.eclipse.ecf.remoteservice.eventadmin.EventMessage.<init>(EventMessage.java:35) at org.eclipse.ecf.remoteservice.eventadmin.DistributedEventAdmin.createMessageDataFromEvent(DistributedEventAdmin.java:249) at org.eclipse.ecf.remoteservice.eventadmin.DistributedEventAdmin.sendMessage(DistributedEventAdmin.java:205) ... it seems that the failure is in the serialization of one of your properties in the Event...specifically the property 'clientBundle.version'. First question: this is one of the properties you added to the event, isn't it? Something to note: Every one of the the event properties must be Serializable...so that the Event itself can be serialized and distributed (with the generic provider). It seems likely to me that the value of this property (which is reported in the stack trace as value=1.0.0.qualifier) is actually of type org.osgi.framework.Version (gotten from Bundle.getVersion()?)...which is *not* Serializable. This fits with the error message: Cannot serialize property value of name=clientBundle.version and value=1.0.0.qualifier If the value is converted from org.osgi.framework.Version to...e.g...a String...e.g. String bundleVersionValue = bundle.getVersion().toString(); then it then should be Serializable.
Resolving, as this seems to be problem with one of the event properties being not serializable rather than a problem with ECF distributed event admin.