Kalpa has already merged this. I hope you can continue the work with this fix.
On Wed, May 11, 2016 at 1:43 PM, Asitha Nanayakkara <asi...@wso2.com> wrote: > I raised the question in Hazelcast Gitter community and they got back to > me saying to use the com.hazelcast.config.Config#setClassLoader(...) to set > the requeired class loader as the solution. > > Since the issue affects all the users of carbon Hzelcast module we have to > fix this in carbon Hazelcast module. > > @Kishanthan I've created a PR [1] with the suggested fix (by Hazelcast) to > add the carbon hazelcast module class loader as the class loader of > hazelcast bundle. Please review and merge. > > [1] https://github.com/wso2/carbon-kernel/pull/974 > > > On Tue, May 10, 2016 at 5:13 PM, Asitha Nanayakkara <asi...@wso2.com> > wrote: > >> Hi All, >> >> We came across an issue with Hazelcast topics when passing custom message >> objects (Can occur for Maps and all the other data structures in Hazelcast) >> with C5 Hazelcast module. We have created an issue for this as well [1]. >> Use case >> >> I'm working with Hazelcast reliable topics in an OSGi environment. I'm >> using a custom message object with Hazelcast topics ClusterNotification >> <https://github.com/wso2/andes/blob/v3.1.5/modules/andes-core/broker/src/main/java/org/wso2/andes/server/cluster/coordination/ClusterNotification.java> >> . >> >> public class ClusterSubscriptionChangedListener implements >> MessageListener<ClusterNotification> { >> >> /** >> * This method is triggered when a subscription is changed in clustered >> environment. >> * >> * @param message contains the ClusterNotification >> */ >> @Override >> public void onMessage(Message<ClusterNotfication> message) { >> // message handling logic >> } >> } >> >> I'm publishing/receiving messages to/from Hazelcast topics from another >> OSGi bundle. >> Issue >> >> I can publish messages to the topic successfully. But I don't receive the >> messages from the listener. This is because, when the Hazelcast topic ring >> buffer runners try to pick the serialized message and de-serialize, it >> throws a ClassNotFoundException. *And the exception is silently ignored* >> and the message never received. >> Root cause >> >> Class loader of the Hazelcast bundle cannot see the classes of my bundle. >> Therefore even though I can publish the message from my bundle, Within >> Hazelcast it can't de-serialize the ClusterNotification >> <https://github.com/wso2/andes/blob/v3.1.5/modules/andes-core/broker/src/main/java/org/wso2/andes/server/cluster/coordination/ClusterNotification.java> >> object since the class loader of Hazelcast bundle cannot see the class. >> Solution, way forward? >> >> >> 1. After having an offline discussion with Kishanthan we built the >> hazelcast bundle with <DynamicImport-Package>*</DynamicImport-Package> >> in the hazelcast pom.xml >> <https://github.com/hazelcast/hazelcast/blob/v3.6/hazelcast/pom.xml> >> and we successfully received the messages (We didn't get the >> ClassNotFoundException). But we need a fix from Hazelcast. >> 2. Another way Hazelcast has provided is to set the class loader for >> the HazelcastInstance. So Internally Hazelcast instance will use the >> provided class loader to deserialize the objects. If we provide our bundle >> class loader it will properly deserialize the object without an issue. >> >> >> @Kishanthan I tried to set the class loader of the carbon-kernel >> hazelcast module to the hazelcast instance (when creating the hazelcast >> instance[2]) and added dynamic imports * property (to get the solution 2 >> working from the carbon kernel hazelcast module itself). Still I'm having >> issues in loading the Andes classes thorough the carbon Hazelcast module >> class loader. >> [1] https://github.com/hazelcast/hazelcast/issues/8139 >> [2] >> https://github.com/wso2/carbon-kernel/blob/hamming-release-poc/modules/carbon-hazelcast/component/src/main/java/org/wso2/carbon/hazelcast/internal/CarbonHazelcastComponent.java#L60 >> >> Regards, >> Asitha >> >> -- >> *Asitha Nanayakkara* >> Software Engineer >> WSO2, Inc. http://wso2.com/ >> Mob: +94 77 853 0682 >> >> > > > -- > *Asitha Nanayakkara* > Software Engineer > WSO2, Inc. http://wso2.com/ > Mob: +94 77 853 0682 > > -- *Kishanthan Thangarajah* Associate Technical Lead, Platform Technologies Team, WSO2, Inc. lean.enterprise.middleware Mobile - +94773426635 Blog - *http://kishanthan.wordpress.com <http://kishanthan.wordpress.com>* Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev