Question

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?

Was it helpful?

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.

OTHER TIPS

Take a look at https://github.com/aseovic/coherence-tools project which should work.

Take a look at the core module which has scripting support in the com.seovic.core.expression.ScriptExpression class. Take a look at the unit tests as well for an example of how to use it.

I am using some of the modules in this project currently and it is well tested and robust. I am not using the expression support at the moment so I would be interested to know your experience with it.

Abhinav

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top