Oh, looks like this problem is already fixed:
https://issues.apache.org/jira/browse/IGNITE-6944
I checked, your project works, when Ignite from current master is used.

So, you can just wiat for the next release and switch to it.

Denis

ср, 20 дек. 2017 г. в 13:10, Denis Mekhanikov <[email protected]>:

> Hi Łukasz!
>
> This problem is caused by *@Cacheable* annotation on 
> *SampleRepo#getSampleEntity()
> *method.
> When you invoke it for the first time, its result is put into an Ignite
> cache. And for the second time the result is just taken from the cache, you
> probably know that.
>
> The problem is that *SampleEntity* contains a *key* field, which
> internally uses *SingletonImmutableList* class. This class has
> *writeReplace()* method, that alters the serialization. I guess, that
> lookup for this method was broken for *BinaryMarshaller* in 2.3 release.
>
> *SingletonImmutableList* has a transient field *element*. When you put
> this value into a cache, it is serialized, and value of this field is
> omitted. When you get this value from cache, this field is null, which
> causes the NPE.
>
> But actually this class should be serialized, using *writeReplace()*
> method. It works fine if you change marshaller to Optimized. To do it, add
> the following line to *CacheConfig#provideDevIgniteConfiguration():*
>
> cfg.setMarshaller(new OptimizedMarshaller(false));
>
> Note, that Optimized marshaller actually has a number of restrictions.
> Features like IgniteCache.withKeepBinary(), .NET, C++, ODBC won't work with
> it. It may also affect performance, especially if you use SQL.
>
> I'll investigate this problem further. I hope, it will be fixed by 2.4
> release.
>
> Denis
>
> вт, 19 дек. 2017 г. в 0:37, lukaszbyjos <[email protected]>:
>
>> I have created repo for this error to easier recreate.
>>
>> https://github.com/Mistic92/ignite-bug
>>
>> When using 2.2.0 everything is ok. But after update to 2.3.0 I get error
>>
>> Caused by: org.apache.ignite.binary.BinaryObjectException: Failed to read
>> field [name=XXXX]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryFieldAccessor.read(BinaryFieldAccessor.java:168)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:843)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         ... 135 more
>> Caused by: java.lang.NullPointerException
>>         at
>> com.google.common.collect.ImmutableList.hashCode(ImmutableList.java:571)
>> ~[guava-20.0.jar:?]
>>         at java.util.Arrays.hashCode(Arrays.java:4146) ~[?:1.8.0_152]
>>         at java.util.Objects.hash(Objects.java:128) ~[?:1.8.0_152]
>>         at com.google.cloud.datastore.BaseKey.hashCode(BaseKey.java:204)
>> ~[google-cloud-datastore-1.8.0.jar:1.8.0]
>>         at
>>
>> com.jmethods.catatumbo.DefaultDatastoreKey.hashCode(DefaultDatastoreKey.java:134)
>> ~[catatumbo-catatumbo-2.4.0.jar:2.4.0]
>>         at java.util.HashMap.hash(HashMap.java:339) ~[?:1.8.0_152]
>>         at java.util.HashMap.put(HashMap.java:612) ~[?:1.8.0_152]
>>         at java.util.HashSet.add(HashSet.java:220) ~[?:1.8.0_152]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryUtils.doReadCollection(BinaryUtils.java:2093)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1914)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1714)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryReaderExImpl.readField(BinaryReaderExImpl.java:1982)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.read0(BinaryFieldAccessor.java:679)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryFieldAccessor.read(BinaryFieldAccessor.java:164)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         at
>>
>> org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:843)
>> ~[ignite-core-2.3.0.jar:2.3.0]
>>         ... 135 more
>>
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>

Reply via email to