class org.apache.ignite.binary.BinaryObjectException: Failed to register class.

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

class org.apache.ignite.binary.BinaryObjectException: Failed to register class.

This post has NOT been accepted by the mailing list yet.
Hi folks,

I'm a newbie in apache ignite;
so, what i try to achieve is to save some case class RDD into cache;
here is my code:

import org.apache.ignite.configuration._
case class MyData1(@QuerySqlField val id: String, @QuerySqlField val name: String) extends Serializable {}
val sparkRdd = sc.parallelize(1 to 10).map(x => (x.toString, MyData1(x.toString, "test-" + x.toString)))
val igniteContext = new IgniteContext[String, MyData1](sc, ()=>new IgniteConfiguration())
val cacheRdd = igniteContext.fromCache("cache-00011")
cacheRdd.savePairs(sparkRdd)

i get "class org.apache.ignite.binary.BinaryObjectException" after savePairs call;
Stack:

class org.apache.ignite.binary.BinaryObjectException: Failed to register class.
        at org.apache.ignite.internal.binary.BinaryContext.registerUserClassDescriptor(BinaryContext.java:565)
        at org.apache.ignite.internal.binary.BinaryContext.registerClassDescriptor(BinaryContext.java:541)
        at org.apache.ignite.internal.binary.BinaryContext.descriptorForClass(BinaryContext.java:443)
        at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:145)
        at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:132)
        at org.apache.ignite.internal.binary.BinaryWriterExImpl.doWriteObject(BinaryWriterExImpl.java:445)
        at org.apache.ignite.internal.binary.BinaryWriterExImpl.writeObjectField(BinaryWriterExImpl.java:1046)
        at org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.write(BinaryFieldAccessor.java:627)
        at org.apache.ignite.internal.binary.BinaryClassDescriptor.write(BinaryClassDescriptor.java:666)
        at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:200)
        at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:132)
        at org.apache.ignite.internal.binary.GridBinaryMarshaller.marshal(GridBinaryMarshaller.java:233)
        at org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl.marshalToBinary(CacheObjectBinaryProcessorImpl.java:441)
        at org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl.toBinary(CacheObjectBinaryProcessorImpl.java:785)
        at org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl.toCacheObject(CacheObjectBinaryProcessorImpl.java:732)
        at org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl.addData(DataStreamerImpl.java:594)
        at org.apache.ignite.spark.IgniteRDD$$anonfun$savePairs$1$$anonfun$apply$2.apply(IgniteRDD.scala:182)
        at org.apache.ignite.spark.IgniteRDD$$anonfun$savePairs$1$$anonfun$apply$2.apply(IgniteRDD.scala:181)
        at scala.collection.Iterator$class.foreach(Iterator.scala:727)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
        at org.apache.ignite.spark.IgniteRDD$$anonfun$savePairs$1.apply(IgniteRDD.scala:181)
        at org.apache.ignite.spark.IgniteRDD$$anonfun$savePairs$1.apply(IgniteRDD.scala:170)
        at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$33.apply(RDD.scala:920)
        at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$33.apply(RDD.scala:920)
        at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1858)
        at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1858)
        at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)
        at org.apache.spark.scheduler.Task.run(Task.scala:89)
        at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:213)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteCheckedException: Type ID collision detected [id=104693, clsName1=$line68.$read$$iwC$$iwC, clsName2=$line28.$read$$iwC$$iwC]
        at org.apache.ignite.internal.MarshallerContextImpl.registerClassName(MarshallerContextImpl.java:116)
        at org.apache.ignite.internal.MarshallerContextAdapter.registerClass(MarshallerContextAdapter.java:157)
        at org.apache.ignite.internal.binary.BinaryContext.registerUserClassDescriptor(BinaryContext.java:562)

Ignite is started with default configuration in the same docker container with spark

example with default java classes (Int) works well:

val rdd = sc.parallelize(1 to 10).map(x => (x, x * 10))
val igniteContext = new IgniteContext[Int, Int](sc, () => new IgniteConfiguration())
val cacheRdd = igniteContext.fromCache("cache-00010")
cacheRdd.savePairs(rdd)
val collected = cacheRdd.filter( _._1 > 5).collect()



Does anybody have an idea what I am making wrong here ?

thanks,
Dmitry
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: class org.apache.ignite.binary.BinaryObjectException: Failed to register class.

Hi Dmitry,

Can you please properly subscribe to the mailing list so that community receives email notifications? Follow the instruction here: http://apache-ignite-users.70518.x6.nabble.com/mailing_list/MailingListOptions.jtp?forum=1

Dmitry wrote
.....

Caused by: class org.apache.ignite.IgniteCheckedException: Type ID collision detected [id=104693, clsName1=$line68.$read$$iwC$$iwC, clsName2=$line28.$read$$iwC$$iwC]
This is a known issue and it's already fixed (will be released in 1.6). Can you try to build from master and check if your test works there?

-Val
Dmitry Dmitry
Reply | Threaded
Open this post in threaded view
|

Re: class org.apache.ignite.binary.BinaryObjectException: Failed to register class.

This post has NOT been accepted by the mailing list yet.
hi Val,

thanks for your help;
I have tried last Jenkins build (https://builds.apache.org/view/H-L/view/Ignite/job/Ignite-nightly/lastSuccessfulBuild/artifact/target/bin/apache-ignite-fabric-1.6.0-SNAPSHOT-bin.zip) and code from master branch, both;

With this version i collide with different issue for my case class caching example;

Stack:

javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: $line30.$read$$iwC$$iwC$Row1
        at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1596)
        at org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$CacheQueryFallbackFuture.retryIfPossible(GridCacheQueryAdapter.java:700)
        at org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$CacheQueryFallbackFuture.next(GridCacheQueryAdapter.java:670)
        at org.apache.ignite.internal.processors.cache.IgniteCacheProxy$5.onHasNext(IgniteCacheProxy.java:529)
        at org.apache.ignite.internal.util.GridCloseableIteratorAdapter.hasNextX(GridCloseableIteratorAdapter.java:53)
        at org.apache.ignite.internal.util.lang.GridIteratorAdapter.hasNext(GridIteratorAdapter.java:45)
        at org.apache.ignite.spark.impl.IgniteQueryIterator.hasNext(IgniteQueryIterator.scala:24)
        at org.apache.spark.util.Utils$.getIteratorSize(Utils.scala:1595)
        at org.apache.spark.rdd.RDD$$anonfun$count$1.apply(RDD.scala:1143)
        at org.apache.spark.rdd.RDD$$anonfun$count$1.apply(RDD.scala:1143)
        at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1858)
        at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1858)
        at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)
        at org.apache.spark.scheduler.Task.run(Task.scala:89)
        at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:213)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteCheckedException: $line30.$read$$iwC$$iwC$Row1
        at org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7037)
        at org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:168)
        at org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:117)
        at org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.get(GridCacheQueryFutureAdapter.java:490)
        at org.apache.ignite.internal.processors.cache.query.GridCacheLocalQueryFuture.awaitFirstPage(GridCacheLocalQueryFuture.java:83)
        at org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$CacheQueryFallbackFuture.next(GridCacheQueryAdapter.java:660)


Do you have any clue what I'm doing wrong ?

Best regards,
Dmitry
Dmitry Dmitry
Reply | Threaded
Open this post in threaded view
|

Re: class org.apache.ignite.binary.BinaryObjectException: Failed to register class.

This post has NOT been accepted by the mailing list yet.
solved by creating case class in jar (previously i create in spark-shell directly)

Best regards,
Dmitry