Serialisation issue.

classic Classic list List threaded Threaded
4 messages Options
adipro adipro
Reply | Threaded
Open this post in threaded view
|

Serialisation issue.

cache = ignite.getOrCreateCache(new CacheConfiguration<>()
                    .setName("DOCIDS")
                    .setStoreKeepBinary(true)
                    .setQueryEntities(Collections.unmodifiableList(new
ArrayList<QueryEntity>(){{
                        QueryEntity entity = new QueryEntity();
                        entity.setKeyType(String.class.getName());
                        entity.setValueType(DOCIDS_CLASS.class.getName());
                        entity.setFields(new
LinkedHashMap<String,String>(){{
                            put("docid",Long.class.getName());
                            put("url",String.class.getName());
                        }});
                        entity.setIndexes(Collections.unmodifiableList(new
ArrayList<QueryIndex>(){{
                            add(new QueryIndex("docid"));
                        }}));
                        add(entity);
                    }}))
                    .setCacheMode(CacheMode.REPLICATED));

When executing the above statements, we are getting below exception:


Caused by: class org.apache.ignite.IgniteCheckedException: Failed to
serialize object: CacheConfiguration [name=DOCIDS, grpName=null,
memPlcName=null, storeConcurrentLoadAllThreshold=5, rebalancePoolSize=1,
rebalanceTimeout=10000, evictPlc=null, evictPlcFactory=null,
onheapCache=false, sqlOnheapCache=false, sqlOnheapCacheMaxSize=0,
evictFilter=null, eagerTtl=true, dfltLockTimeout=0, nearCfg=null,
writeSync=null, storeFactory=null, storeKeepBinary=true, loadPrevVal=false,
aff=null, cacheMode=REPLICATED, atomicityMode=null, backups=0,
invalidate=false, tmLookupClsName=null, rebalanceMode=ASYNC,
rebalanceOrder=0, rebalanceBatchSize=524288, rebalanceBatchesPrefetchCnt=2,
maxConcurrentAsyncOps=500, sqlIdxMaxInlineSize=-1, writeBehindEnabled=false,
writeBehindFlushSize=10240, writeBehindFlushFreq=5000,
writeBehindFlushThreadCnt=1, writeBehindBatchSize=512,
writeBehindCoalescing=true, maxQryIterCnt=1024, affMapper=null,
rebalanceDelay=0, rebalanceThrottle=0, interceptor=null,
longQryWarnTimeout=3000, qryDetailMetricsSz=0, readFromBackup=true,
nodeFilter=null, sqlSchema=null, sqlEscapeAll=false, cpOnRead=true,
topValidator=null, partLossPlc=IGNORE, qryParallelism=1, evtsDisabled=false,
encryptionEnabled=false]
        at
org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:102)
        at
org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:69)
        at
org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:116)
        at
org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:57)
        at
org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:10131)
        at
org.apache.ignite.internal.processors.cache.GridCacheProcessor$11.applyx(GridCacheProcessor.java:5419)
        ... 19 more
Caused by: java.io.NotSerializableException:
org.apache.ignite.configuration.IgniteConfiguration
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at java.util.ArrayList.writeObject(ArrayList.java:766)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1128)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at
org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:97)



Can someone please help?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
adipro adipro
Reply | Threaded
Open this post in threaded view
|

Re: Serialisation issue.

Team, is there anyone who could help on this?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ezhuravlev ezhuravlev
Reply | Threaded
Open this post in threaded view
|

Re: Serialisation issue.

In reply to this post by adipro
Hi,

I'm able to start the cache with this configuration. Which version do you
use? Can you share small project with a reproducer, as this code snippet
works without a problem?

Evgenii



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Ilya Kasnacheev Ilya Kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Serialisation issue.

In reply to this post by adipro
Hello!

I, for one, do not recommend using new Collection() {{ }} in your configurations.

It will create a non-static anonymous class, which may bind arbitrary amount of symbols from current lexical content, which will then need to be serialized to be sent to other nodes.

Please use other ways to create pre-populated collections, such as Commons Collect.

Regards,

On 2020/02/07 12:16:23, adipro <[hidden email]> wrote:

> cache = ignite.getOrCreateCache(new CacheConfiguration<>()
>                     .setName("DOCIDS")
>                     .setStoreKeepBinary(true)
>                     .setQueryEntities(Collections.unmodifiableList(new
> ArrayList<QueryEntity>(){{
>                         QueryEntity entity = new QueryEntity();
>                         entity.setKeyType(String.class.getName());
>                         entity.setValueType(DOCIDS_CLASS.class.getName());
>                         entity.setFields(new
> LinkedHashMap<String,String>(){{
>                             put("docid",Long.class.getName());
>                             put("url",String.class.getName());
>                         }});
>                         entity.setIndexes(Collections.unmodifiableList(new
> ArrayList<QueryIndex>(){{
>                             add(new QueryIndex("docid"));
>                         }}));
>                         add(entity);
>                     }}))
>                     .setCacheMode(CacheMode.REPLICATED));
>
> When executing the above statements, we are getting below exception:
>
>
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to
> serialize object: CacheConfiguration [name=DOCIDS, grpName=null,
> memPlcName=null, storeConcurrentLoadAllThreshold=5, rebalancePoolSize=1,
> rebalanceTimeout=10000, evictPlc=null, evictPlcFactory=null,
> onheapCache=false, sqlOnheapCache=false, sqlOnheapCacheMaxSize=0,
> evictFilter=null, eagerTtl=true, dfltLockTimeout=0, nearCfg=null,
> writeSync=null, storeFactory=null, storeKeepBinary=true, loadPrevVal=false,
> aff=null, cacheMode=REPLICATED, atomicityMode=null, backups=0,
> invalidate=false, tmLookupClsName=null, rebalanceMode=ASYNC,
> rebalanceOrder=0, rebalanceBatchSize=524288, rebalanceBatchesPrefetchCnt=2,
> maxConcurrentAsyncOps=500, sqlIdxMaxInlineSize=-1, writeBehindEnabled=false,
> writeBehindFlushSize=10240, writeBehindFlushFreq=5000,
> writeBehindFlushThreadCnt=1, writeBehindBatchSize=512,
> writeBehindCoalescing=true, maxQryIterCnt=1024, affMapper=null,
> rebalanceDelay=0, rebalanceThrottle=0, interceptor=null,
> longQryWarnTimeout=3000, qryDetailMetricsSz=0, readFromBackup=true,
> nodeFilter=null, sqlSchema=null, sqlEscapeAll=false, cpOnRead=true,
> topValidator=null, partLossPlc=IGNORE, qryParallelism=1, evtsDisabled=false,
> encryptionEnabled=false]
> at
> org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:102)
> at
> org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:69)
> at
> org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:116)
> at
> org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:57)
> at
> org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:10131)
> at
> org.apache.ignite.internal.processors.cache.GridCacheProcessor$11.applyx(GridCacheProcessor.java:5419)
> ... 19 more
> Caused by: java.io.NotSerializableException:
> org.apache.ignite.configuration.IgniteConfiguration
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> at java.util.ArrayList.writeObject(ArrayList.java:766)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1128)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> at
> org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:97)
>
>
>
> Can someone please help?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>