Search code examples
javadistributed-cachingoracle-coherence

How can I put javax.script.CompiledScript in Oracle Coherence distributed cache?


I have a model object which has javax.script.CompiledScript as member variable. I am trying to put the model objects in Oracle Coherence distributed cache and am getting below exception

(Wrapped) java.io.NotSerializableException: com.sun.script.javascript.RhinoCompiledScript
     at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:210)
     at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConverterValueToBinary.convert(DistributedCache.CDB:3)
     at com.tangosol.util.ConverterCollections$ConverterCacheMap.put(ConverterCollections.java:2433)
     at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ViewMap.put(DistributedCache.CDB:1)
     at com.tangosol.coherence.component.util.SafeNamedCache.put(SafeNamedCache.CDB:1)
     at com.tangosol.net.cache.CachingMap.put(CachingMap.java:939)
     at com.tangosol.net.cache.CachingMap.put(CachingMap.java:898)
     at com.tangosol.net.cache.CachingMap.put(CachingMap.java:810)
     at com.coname.caching.CoherenceCacheProvider.putAll(CoherenceCacheProvider.java:98)
     at com.coname.caching.CacheService.putAll(CacheService.java:91)
     at com.coname.model.modelname.configuration.MetadataConfigurationService.loadTheCache(MetadataConfigurationService.java:32)

I see other questions which suggest using Portable Object Format (POF) Serialization. But I don't know the internal object representation of com.sun.script.javascript.RhinoCompiledScript so I don't know how to implement PofSerializer interface. How can I put javax.script.CompiledScript to Oracle Coherence distributed cache?


Solution

  • I found Alexey Ragozin's gridkit which has ReflectionPofSerializer https://code.google.com/p/gridkit/wiki/ReflectionPofSerializer but am getting java.lang.StackOverflowError using that. Tried AutoPofSerializer and got StackOverflowError. Logged defect https://code.google.com/p/gridkit/issues/detail?id=24&colspec=ID%20Type%20Status%20Priority%20Component%20Milestone%20Owner%20Summary to get help from Alexey.