You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by saikiran939 <sa...@gmail.com> on 2017/09/07 06:50:31 UTC

BinaryObject model replace() in client/server topology fails with ClassNotFoundFunction

Hi Team,

Our team on working on a usecase in which we don't want to have any classes
on Ignite Server node's classpath. To achieve this we are making use of
BinaryObject based querying and putting/replacing values into cache.

We are also using Optimistic Locking to replace the values into cache using
"binaryObjectcache.replace(key, oldValue, newValue)" API - this method fails
with ClassNotFoundException when used in client/server topology if the cache
value class is not present at server's classpath. Sample piece of code is
given below:

String key = "key1";
CacheValue entry1 = new CacheValue("putsomevalue");
IgniteCache<String, CacheValue> cache = ignite.getOrCreateCache(cacheCfg);
cache.put(key, entry1); //put works fine even if there is no class present
in server's classpath

CacheValue replaceEntry1 = cache.get(key);
replaceEntry1.location= "test";
			
IgniteCache<String, BinaryObject> binaryCacheProjection =
cache.withKeepBinary();
BinaryObject oldValueInBinary = binaryCacheProjection.get(key);
BinaryObject newValueInBinary = ignite.binary().toBinary(replaceEntry1);
binaryCacheProjection.replace(key, oldValueInBinary, newValueInBinary);

The last replace() method call fails with below exception, is this bug in
ignite because put() API works or is there anyway to workaround this
exception ? I think from the stacktrace ignite server is trying to
deserialize value object even if it is binary. I get the same exception with
normal cache.replace() API .

Exception in thread "main"
org.apache.ignite.cache.CachePartialUpdateException: Failed to update keys
(retry update if possible).: [OP21|SHARED]
	at
org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1488)
	at
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.cacheException(IgniteCacheProxy.java:2021)
	at
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.replace(IgniteCacheProxy.java:1393)
	at
com.ignite.binary.TestReplaceBinaryObject.populateCache(TestReplaceBinaryObject.java:166)
	at
com.ignite.binary.TestReplaceBinaryObject.main(TestReplaceBinaryObject.java:60)
	at com.ignite.binary.IgniteDriver.main(IgniteDriver.java:11)
Caused by: class
org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException:
Failed to update keys (retry update if possible).: [OP21|SHARED]
	at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture.onResult(GridNearAtomicSingleUpdateFuture.java:232)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.processNearAtomicUpdateResponse(GridDhtAtomicCache.java:2969)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.access$700(GridDhtAtomicCache.java:130)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:274)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:272)
	at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:748)
	at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:353)
	at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:277)
	at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$000(GridCacheIoManager.java:88)
	at
org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:231)
	at
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1238)
	at
org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:866)
	at
org.apache.ignite.internal.managers.communication.GridIoManager.access$1700(GridIoManager.java:106)
	at
org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:829)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
	Suppressed: class org.apache.ignite.IgniteCheckedException: Failed to
update keys on primary node.
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse.addFailedKey(GridNearAtomicUpdateResponse.java:350)
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2393)
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAtomicCache.java:1652)
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtomicCache.java:1490)
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest(GridDhtAtomicCache.java:2950)
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.access$600(GridDhtAtomicCache.java:130)
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:268)
		at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:266)
		... 12 more
		Suppressed: class org.apache.ignite.IgniteCheckedException:
com.ignite.binary.CacheValue
			at
org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7142)
			at
org.apache.ignite.internal.processors.cache.GridCacheContext.isAllLocked(GridCacheContext.java:1252)
			at
org.apache.ignite.internal.processors.cache.GridCacheMapEntry.innerUpdate(GridCacheMapEntry.java:2241)
			at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2252)
			... 18 more
		Caused by: java.lang.ClassNotFoundException: com.ignite.binary.CacheValue
			at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
			at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
			at java.security.AccessController.doPrivileged(Native Method)
			at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
			at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
			at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
			at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
			at java.lang.Class.forName0(Native Method)
			at java.lang.Class.forName(Class.java:266)
			at
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8350)
			at
org.apache.ignite.internal.MarshallerContextAdapter.getClass(MarshallerContextAdapter.java:185)
			at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:662)
			at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1474)
			at
org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:585)
			at
org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:142)
			at
org.apache.ignite.internal.processors.cache.GridCacheUtils.value(GridCacheUtils.java:1512)
			at
org.apache.ignite.internal.processors.cache.CacheEntryPredicateContainsValue.apply(CacheEntryPredicateContainsValue.java:63)
			at
org.apache.ignite.internal.processors.cache.CacheEntryPredicateContainsValue.apply(CacheEntryPredicateContainsValue.java:32)
			at
org.apache.ignite.internal.processors.cache.GridCacheContext.isAllLocked(GridCacheContext.java:1246)
			... 20 more
			




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: BinaryObject model replace() in client/server topology fails with ClassNotFoundFunction

Posted by Andrey Mashenkov <an...@gmail.com>.
Crossposting to dev list.

Guys,
Do we have any ETA for next releases?
I see no dates on release page [1].

[1]
https://issues.apache.org/jira/projects/IGNITE?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page

On Mon, Sep 11, 2017 at 2:00 PM, Andrey Mashenkov <
andrey.mashenkov@gmail.com> wrote:

> I've created a ticket for this [1].
> As a workaround you can try to use cache.invoke() with own comparison
> implementation inside EntryProcessor.
>
> Unfortunately, there is no release dated filled on apache ignite releases
> page [2].
> Usually, new Ignite release become available twice a year.
>
> [1] https://issues.apache.org/jira/browse/IGNITE-6332
> [2] https://issues.apache.org/jira/projects/IGNITE?
> selectedItem=com.atlassian.jira.jira-projects-plugin:release-page
>
> On Thu, Sep 7, 2017 at 9:50 PM, sai kiran nukala <sa...@gmail.com>
> wrote:
>
>> Thanks for the reply.
>>
>> How do I file a ticket ?
>>
>> I know it is still early stage, usually how long it takes to fix this bug
>> and release a version because we need this functionality working for our
>> use case.
>>
>> On Sep 7, 2017 10:22 PM, "Andrey Mashenkov" <an...@gmail.com>
>> wrote:
>>
>> Hi,
>> Looks like a bug and CacheEntryPredicateContainsValue shouldn't
>> deserialize value to compare BinaryObjects in case of replace() operation
>> .
>> Feel free to fill a ticket for this.
>>
>>
>>
>> On Thu, Sep 7, 2017 at 9:50 AM, saikiran939 <sa...@gmail.com>
>> wrote:
>>
>>> Hi Team,
>>>
>>> Our team on working on a usecase in which we don't want to have any
>>> classes
>>> on Ignite Server node's classpath. To achieve this we are making use of
>>> BinaryObject based querying and putting/replacing values into cache.
>>>
>>> We are also using Optimistic Locking to replace the values into cache
>>> using
>>> "binaryObjectcache.replace(key, oldValue, newValue)" API - this method
>>> fails
>>> with ClassNotFoundException when used in client/server topology if the
>>> cache
>>> value class is not present at server's classpath. Sample piece of code is
>>> given below:
>>>
>>> String key = "key1";
>>> CacheValue entry1 = new CacheValue("putsomevalue");
>>> IgniteCache<String, CacheValue> cache = ignite.getOrCreateCache(cacheC
>>> fg);
>>> cache.put(key, entry1); //put works fine even if there is no class
>>> present
>>> in server's classpath
>>>
>>> CacheValue replaceEntry1 = cache.get(key);
>>> replaceEntry1.location= "test";
>>>
>>> IgniteCache<String, BinaryObject> binaryCacheProjection =
>>> cache.withKeepBinary();
>>> BinaryObject oldValueInBinary = binaryCacheProjection.get(key);
>>> BinaryObject newValueInBinary = ignite.binary().toBinary(replaceEntry1);
>>> binaryCacheProjection.replace(key, oldValueInBinary, newValueInBinary);
>>>
>>> The last replace() method call fails with below exception, is this bug in
>>> ignite because put() API works or is there anyway to workaround this
>>> exception ? I think from the stacktrace ignite server is trying to
>>> deserialize value object even if it is binary. I get the same exception
>>> with
>>> normal cache.replace() API .
>>>
>>> Exception in thread "main"
>>> org.apache.ignite.cache.CachePartialUpdateException: Failed to update
>>> keys
>>> (retry update if possible).: [OP21|SHARED]
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheUtils.c
>>> onvertToCacheException(GridCacheUtils.java:1488)
>>>         at
>>> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
>>> .cacheException(IgniteCacheProxy.java:2021)
>>>         at
>>> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
>>> .replace(IgniteCacheProxy.java:1393)
>>>         at
>>> com.ignite.binary.TestReplaceBinaryObject.populateCache(Test
>>> ReplaceBinaryObject.java:166)
>>>         at
>>> com.ignite.binary.TestReplaceBinaryObject.main(TestReplaceBi
>>> naryObject.java:60)
>>>         at com.ignite.binary.IgniteDriver.main(IgniteDriver.java:11)
>>> Caused by: class
>>> org.apache.ignite.internal.processors.cache.CachePartialUpda
>>> teCheckedException:
>>> Failed to update keys (retry update if possible).: [OP21|SHARED]
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridNearAtomicSingleUpdateFuture.onResult(GridNearAto
>>> micSingleUpdateFuture.java:232)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.processNearAtomicUpdateResponse(Gr
>>> idDhtAtomicCache.java:2969)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.access$700(GridDhtAtomicCache.java:130)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:274)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:272)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.processMessage(GridCacheIoManager.java:748)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.onMessage0(GridCacheIoManager.java:353)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.handleMessage(GridCacheIoManager.java:277)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.access$000(GridCacheIoManager.java:88)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er$1.onMessage(GridCacheIoManager.java:231)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger.invokeListener(GridIoManager.java:1238)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger.processRegularMessage0(GridIoManager.java:866)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger.access$1700(GridIoManager.java:106)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger$5.run(GridIoManager.java:829)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>> Executor.java:1145)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>> lExecutor.java:615)
>>>         at java.lang.Thread.run(Thread.java:722)
>>>         Suppressed: class org.apache.ignite.IgniteCheckedException:
>>> Failed to
>>> update keys on primary node.
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridNearAtomicUpdateResponse.addFailedKey(GridNearAto
>>> micUpdateResponse.java:350)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2393)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAto
>>> micCache.java:1652)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtom
>>> icCache.java:1490)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest(Gri
>>> dDhtAtomicCache.java:2950)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.access$600(GridDhtAtomicCache.java:130)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:268)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:266)
>>>                 ... 12 more
>>>                 Suppressed: class org.apache.ignite.IgniteChecke
>>> dException:
>>> com.ignite.binary.CacheValue
>>>                         at
>>> org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7142)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheContext
>>> .isAllLocked(GridCacheContext.java:1252)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheMapEntr
>>> y.innerUpdate(GridCacheMapEntry.java:2241)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2252)
>>>                         ... 18 more
>>>                 Caused by: java.lang.ClassNotFoundException:
>>> com.ignite.binary.CacheValue
>>>                         at java.net.URLClassLoader$1.run(
>>> URLClassLoader.java:366)
>>>                         at java.net.URLClassLoader$1.run(
>>> URLClassLoader.java:355)
>>>                         at java.security.AccessController.doPrivileged(Native
>>> Method)
>>>                         at java.net.URLClassLoader.findCl
>>> ass(URLClassLoader.java:354)
>>>                         at java.lang.ClassLoader.loadClas
>>> s(ClassLoader.java:423)
>>>                         at sun.misc.Launcher$AppClassLoad
>>> er.loadClass(Launcher.java:308)
>>>                         at java.lang.ClassLoader.loadClas
>>> s(ClassLoader.java:356)
>>>                         at java.lang.Class.forName0(Native Method)
>>>                         at java.lang.Class.forName(Class.java:266)
>>>                         at
>>> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUt
>>> ils.java:8350)
>>>                         at
>>> org.apache.ignite.internal.MarshallerContextAdapter.getClass
>>> (MarshallerContextAdapter.java:185)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryContext.descriptorFo
>>> rTypeId(BinaryContext.java:662)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryReaderExImpl.deseria
>>> lize(BinaryReaderExImpl.java:1474)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryObjectImpl.deseriali
>>> zeValue(BinaryObjectImpl.java:585)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryObjectImpl.value(Bin
>>> aryObjectImpl.java:142)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheUtils.v
>>> alue(GridCacheUtils.java:1512)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.CacheEntryPredic
>>> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:63)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.CacheEntryPredic
>>> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:32)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheContext
>>> .isAllLocked(GridCacheContext.java:1246)
>>>                         ... 20 more
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>>
>>
>>
>>
>> --
>> Best regards,
>> Andrey V. Mashenkov
>>
>>
>>
>
>
> --
> Best regards,
> Andrey V. Mashenkov
>



-- 
Best regards,
Andrey V. Mashenkov

Re: BinaryObject model replace() in client/server topology fails with ClassNotFoundFunction

Posted by sai kiran nukala <sa...@gmail.com>.
I don't think entryprocessor with work because the anonymous class will not
be present at ignite server node classpath as our aim is to avoid classes
at server's classpath.

On Sep 11, 2017 4:30 PM, "Andrey Mashenkov" <an...@gmail.com>
wrote:

> I've created a ticket for this [1].
> As a workaround you can try to use cache.invoke() with own comparison
> implementation inside EntryProcessor.
>
> Unfortunately, there is no release dated filled on apache ignite releases
> page [2].
> Usually, new Ignite release become available twice a year.
>
> [1] https://issues.apache.org/jira/browse/IGNITE-6332
> [2] https://issues.apache.org/jira/projects/IGNITE?
> selectedItem=com.atlassian.jira.jira-projects-plugin:release-page
>
> On Thu, Sep 7, 2017 at 9:50 PM, sai kiran nukala <sa...@gmail.com>
> wrote:
>
>> Thanks for the reply.
>>
>> How do I file a ticket ?
>>
>> I know it is still early stage, usually how long it takes to fix this bug
>> and release a version because we need this functionality working for our
>> use case.
>>
>> On Sep 7, 2017 10:22 PM, "Andrey Mashenkov" <an...@gmail.com>
>> wrote:
>>
>> Hi,
>> Looks like a bug and CacheEntryPredicateContainsValue shouldn't
>> deserialize value to compare BinaryObjects in case of replace() operation
>> .
>> Feel free to fill a ticket for this.
>>
>>
>>
>> On Thu, Sep 7, 2017 at 9:50 AM, saikiran939 <sa...@gmail.com>
>> wrote:
>>
>>> Hi Team,
>>>
>>> Our team on working on a usecase in which we don't want to have any
>>> classes
>>> on Ignite Server node's classpath. To achieve this we are making use of
>>> BinaryObject based querying and putting/replacing values into cache.
>>>
>>> We are also using Optimistic Locking to replace the values into cache
>>> using
>>> "binaryObjectcache.replace(key, oldValue, newValue)" API - this method
>>> fails
>>> with ClassNotFoundException when used in client/server topology if the
>>> cache
>>> value class is not present at server's classpath. Sample piece of code is
>>> given below:
>>>
>>> String key = "key1";
>>> CacheValue entry1 = new CacheValue("putsomevalue");
>>> IgniteCache<String, CacheValue> cache = ignite.getOrCreateCache(cacheC
>>> fg);
>>> cache.put(key, entry1); //put works fine even if there is no class
>>> present
>>> in server's classpath
>>>
>>> CacheValue replaceEntry1 = cache.get(key);
>>> replaceEntry1.location= "test";
>>>
>>> IgniteCache<String, BinaryObject> binaryCacheProjection =
>>> cache.withKeepBinary();
>>> BinaryObject oldValueInBinary = binaryCacheProjection.get(key);
>>> BinaryObject newValueInBinary = ignite.binary().toBinary(replaceEntry1);
>>> binaryCacheProjection.replace(key, oldValueInBinary, newValueInBinary);
>>>
>>> The last replace() method call fails with below exception, is this bug in
>>> ignite because put() API works or is there anyway to workaround this
>>> exception ? I think from the stacktrace ignite server is trying to
>>> deserialize value object even if it is binary. I get the same exception
>>> with
>>> normal cache.replace() API .
>>>
>>> Exception in thread "main"
>>> org.apache.ignite.cache.CachePartialUpdateException: Failed to update
>>> keys
>>> (retry update if possible).: [OP21|SHARED]
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheUtils.c
>>> onvertToCacheException(GridCacheUtils.java:1488)
>>>         at
>>> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
>>> .cacheException(IgniteCacheProxy.java:2021)
>>>         at
>>> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
>>> .replace(IgniteCacheProxy.java:1393)
>>>         at
>>> com.ignite.binary.TestReplaceBinaryObject.populateCache(Test
>>> ReplaceBinaryObject.java:166)
>>>         at
>>> com.ignite.binary.TestReplaceBinaryObject.main(TestReplaceBi
>>> naryObject.java:60)
>>>         at com.ignite.binary.IgniteDriver.main(IgniteDriver.java:11)
>>> Caused by: class
>>> org.apache.ignite.internal.processors.cache.CachePartialUpda
>>> teCheckedException:
>>> Failed to update keys (retry update if possible).: [OP21|SHARED]
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridNearAtomicSingleUpdateFuture.onResult(GridNearAto
>>> micSingleUpdateFuture.java:232)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.processNearAtomicUpdateResponse(Gr
>>> idDhtAtomicCache.java:2969)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.access$700(GridDhtAtomicCache.java:130)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:274)
>>>         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:272)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.processMessage(GridCacheIoManager.java:748)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.onMessage0(GridCacheIoManager.java:353)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.handleMessage(GridCacheIoManager.java:277)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er.access$000(GridCacheIoManager.java:88)
>>>         at
>>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>>> er$1.onMessage(GridCacheIoManager.java:231)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger.invokeListener(GridIoManager.java:1238)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger.processRegularMessage0(GridIoManager.java:866)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger.access$1700(GridIoManager.java:106)
>>>         at
>>> org.apache.ignite.internal.managers.communication.GridIoMana
>>> ger$5.run(GridIoManager.java:829)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>> Executor.java:1145)
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>> lExecutor.java:615)
>>>         at java.lang.Thread.run(Thread.java:722)
>>>         Suppressed: class org.apache.ignite.IgniteCheckedException:
>>> Failed to
>>> update keys on primary node.
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridNearAtomicUpdateResponse.addFailedKey(GridNearAto
>>> micUpdateResponse.java:350)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2393)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAto
>>> micCache.java:1652)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtom
>>> icCache.java:1490)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest(Gri
>>> dDhtAtomicCache.java:2950)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.access$600(GridDhtAtomicCache.java:130)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:268)
>>>                 at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:266)
>>>                 ... 12 more
>>>                 Suppressed: class org.apache.ignite.IgniteChecke
>>> dException:
>>> com.ignite.binary.CacheValue
>>>                         at
>>> org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7142)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheContext
>>> .isAllLocked(GridCacheContext.java:1252)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheMapEntr
>>> y.innerUpdate(GridCacheMapEntry.java:2241)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.distributed.dht.
>>> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2252)
>>>                         ... 18 more
>>>                 Caused by: java.lang.ClassNotFoundException:
>>> com.ignite.binary.CacheValue
>>>                         at java.net.URLClassLoader$1.run(
>>> URLClassLoader.java:366)
>>>                         at java.net.URLClassLoader$1.run(
>>> URLClassLoader.java:355)
>>>                         at java.security.AccessController.doPrivileged(Native
>>> Method)
>>>                         at java.net.URLClassLoader.findCl
>>> ass(URLClassLoader.java:354)
>>>                         at java.lang.ClassLoader.loadClas
>>> s(ClassLoader.java:423)
>>>                         at sun.misc.Launcher$AppClassLoad
>>> er.loadClass(Launcher.java:308)
>>>                         at java.lang.ClassLoader.loadClas
>>> s(ClassLoader.java:356)
>>>                         at java.lang.Class.forName0(Native Method)
>>>                         at java.lang.Class.forName(Class.java:266)
>>>                         at
>>> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUt
>>> ils.java:8350)
>>>                         at
>>> org.apache.ignite.internal.MarshallerContextAdapter.getClass
>>> (MarshallerContextAdapter.java:185)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryContext.descriptorFo
>>> rTypeId(BinaryContext.java:662)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryReaderExImpl.deseria
>>> lize(BinaryReaderExImpl.java:1474)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryObjectImpl.deseriali
>>> zeValue(BinaryObjectImpl.java:585)
>>>                         at
>>> org.apache.ignite.internal.binary.BinaryObjectImpl.value(Bin
>>> aryObjectImpl.java:142)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheUtils.v
>>> alue(GridCacheUtils.java:1512)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.CacheEntryPredic
>>> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:63)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.CacheEntryPredic
>>> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:32)
>>>                         at
>>> org.apache.ignite.internal.processors.cache.GridCacheContext
>>> .isAllLocked(GridCacheContext.java:1246)
>>>                         ... 20 more
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>>
>>
>>
>>
>> --
>> Best regards,
>> Andrey V. Mashenkov
>>
>>
>>
>
>
> --
> Best regards,
> Andrey V. Mashenkov
>

Re: BinaryObject model replace() in client/server topology fails with ClassNotFoundFunction

Posted by Andrey Mashenkov <an...@gmail.com>.
I've created a ticket for this [1].
As a workaround you can try to use cache.invoke() with own comparison
implementation inside EntryProcessor.

Unfortunately, there is no release dated filled on apache ignite releases
page [2].
Usually, new Ignite release become available twice a year.

[1] https://issues.apache.org/jira/browse/IGNITE-6332
[2]
https://issues.apache.org/jira/projects/IGNITE?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page

On Thu, Sep 7, 2017 at 9:50 PM, sai kiran nukala <sa...@gmail.com>
wrote:

> Thanks for the reply.
>
> How do I file a ticket ?
>
> I know it is still early stage, usually how long it takes to fix this bug
> and release a version because we need this functionality working for our
> use case.
>
> On Sep 7, 2017 10:22 PM, "Andrey Mashenkov" <an...@gmail.com>
> wrote:
>
> Hi,
> Looks like a bug and CacheEntryPredicateContainsValue shouldn't
> deserialize value to compare BinaryObjects in case of replace() operation
> .
> Feel free to fill a ticket for this.
>
>
>
> On Thu, Sep 7, 2017 at 9:50 AM, saikiran939 <sa...@gmail.com> wrote:
>
>> Hi Team,
>>
>> Our team on working on a usecase in which we don't want to have any
>> classes
>> on Ignite Server node's classpath. To achieve this we are making use of
>> BinaryObject based querying and putting/replacing values into cache.
>>
>> We are also using Optimistic Locking to replace the values into cache
>> using
>> "binaryObjectcache.replace(key, oldValue, newValue)" API - this method
>> fails
>> with ClassNotFoundException when used in client/server topology if the
>> cache
>> value class is not present at server's classpath. Sample piece of code is
>> given below:
>>
>> String key = "key1";
>> CacheValue entry1 = new CacheValue("putsomevalue");
>> IgniteCache<String, CacheValue> cache = ignite.getOrCreateCache(cacheC
>> fg);
>> cache.put(key, entry1); //put works fine even if there is no class present
>> in server's classpath
>>
>> CacheValue replaceEntry1 = cache.get(key);
>> replaceEntry1.location= "test";
>>
>> IgniteCache<String, BinaryObject> binaryCacheProjection =
>> cache.withKeepBinary();
>> BinaryObject oldValueInBinary = binaryCacheProjection.get(key);
>> BinaryObject newValueInBinary = ignite.binary().toBinary(replaceEntry1);
>> binaryCacheProjection.replace(key, oldValueInBinary, newValueInBinary);
>>
>> The last replace() method call fails with below exception, is this bug in
>> ignite because put() API works or is there anyway to workaround this
>> exception ? I think from the stacktrace ignite server is trying to
>> deserialize value object even if it is binary. I get the same exception
>> with
>> normal cache.replace() API .
>>
>> Exception in thread "main"
>> org.apache.ignite.cache.CachePartialUpdateException: Failed to update
>> keys
>> (retry update if possible).: [OP21|SHARED]
>>         at
>> org.apache.ignite.internal.processors.cache.GridCacheUtils.c
>> onvertToCacheException(GridCacheUtils.java:1488)
>>         at
>> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
>> .cacheException(IgniteCacheProxy.java:2021)
>>         at
>> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
>> .replace(IgniteCacheProxy.java:1393)
>>         at
>> com.ignite.binary.TestReplaceBinaryObject.populateCache(Test
>> ReplaceBinaryObject.java:166)
>>         at
>> com.ignite.binary.TestReplaceBinaryObject.main(TestReplaceBi
>> naryObject.java:60)
>>         at com.ignite.binary.IgniteDriver.main(IgniteDriver.java:11)
>> Caused by: class
>> org.apache.ignite.internal.processors.cache.CachePartialUpda
>> teCheckedException:
>> Failed to update keys (retry update if possible).: [OP21|SHARED]
>>         at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridNearAtomicSingleUpdateFuture.onResult(GridNearAto
>> micSingleUpdateFuture.java:232)
>>         at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.processNearAtomicUpdateResponse(Gr
>> idDhtAtomicCache.java:2969)
>>         at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.access$700(GridDhtAtomicCache.java:130)
>>         at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:274)
>>         at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:272)
>>         at
>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>> er.processMessage(GridCacheIoManager.java:748)
>>         at
>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>> er.onMessage0(GridCacheIoManager.java:353)
>>         at
>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>> er.handleMessage(GridCacheIoManager.java:277)
>>         at
>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>> er.access$000(GridCacheIoManager.java:88)
>>         at
>> org.apache.ignite.internal.processors.cache.GridCacheIoManag
>> er$1.onMessage(GridCacheIoManager.java:231)
>>         at
>> org.apache.ignite.internal.managers.communication.GridIoMana
>> ger.invokeListener(GridIoManager.java:1238)
>>         at
>> org.apache.ignite.internal.managers.communication.GridIoMana
>> ger.processRegularMessage0(GridIoManager.java:866)
>>         at
>> org.apache.ignite.internal.managers.communication.GridIoMana
>> ger.access$1700(GridIoManager.java:106)
>>         at
>> org.apache.ignite.internal.managers.communication.GridIoMana
>> ger$5.run(GridIoManager.java:829)
>>         at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>> Executor.java:1145)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>> lExecutor.java:615)
>>         at java.lang.Thread.run(Thread.java:722)
>>         Suppressed: class org.apache.ignite.IgniteCheckedException:
>> Failed to
>> update keys on primary node.
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridNearAtomicUpdateResponse.addFailedKey(GridNearAto
>> micUpdateResponse.java:350)
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2393)
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAto
>> micCache.java:1652)
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtom
>> icCache.java:1490)
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest(Gri
>> dDhtAtomicCache.java:2950)
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.access$600(GridDhtAtomicCache.java:130)
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:268)
>>                 at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:266)
>>                 ... 12 more
>>                 Suppressed: class org.apache.ignite.IgniteChecke
>> dException:
>> com.ignite.binary.CacheValue
>>                         at
>> org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7142)
>>                         at
>> org.apache.ignite.internal.processors.cache.GridCacheContext
>> .isAllLocked(GridCacheContext.java:1252)
>>                         at
>> org.apache.ignite.internal.processors.cache.GridCacheMapEntr
>> y.innerUpdate(GridCacheMapEntry.java:2241)
>>                         at
>> org.apache.ignite.internal.processors.cache.distributed.dht.
>> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2252)
>>                         ... 18 more
>>                 Caused by: java.lang.ClassNotFoundException:
>> com.ignite.binary.CacheValue
>>                         at java.net.URLClassLoader$1.run(
>> URLClassLoader.java:366)
>>                         at java.net.URLClassLoader$1.run(
>> URLClassLoader.java:355)
>>                         at java.security.AccessController.doPrivileged(Native
>> Method)
>>                         at java.net.URLClassLoader.findCl
>> ass(URLClassLoader.java:354)
>>                         at java.lang.ClassLoader.loadClas
>> s(ClassLoader.java:423)
>>                         at sun.misc.Launcher$AppClassLoad
>> er.loadClass(Launcher.java:308)
>>                         at java.lang.ClassLoader.loadClas
>> s(ClassLoader.java:356)
>>                         at java.lang.Class.forName0(Native Method)
>>                         at java.lang.Class.forName(Class.java:266)
>>                         at
>> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUt
>> ils.java:8350)
>>                         at
>> org.apache.ignite.internal.MarshallerContextAdapter.getClass
>> (MarshallerContextAdapter.java:185)
>>                         at
>> org.apache.ignite.internal.binary.BinaryContext.descriptorFo
>> rTypeId(BinaryContext.java:662)
>>                         at
>> org.apache.ignite.internal.binary.BinaryReaderExImpl.deseria
>> lize(BinaryReaderExImpl.java:1474)
>>                         at
>> org.apache.ignite.internal.binary.BinaryObjectImpl.deseriali
>> zeValue(BinaryObjectImpl.java:585)
>>                         at
>> org.apache.ignite.internal.binary.BinaryObjectImpl.value(Bin
>> aryObjectImpl.java:142)
>>                         at
>> org.apache.ignite.internal.processors.cache.GridCacheUtils.v
>> alue(GridCacheUtils.java:1512)
>>                         at
>> org.apache.ignite.internal.processors.cache.CacheEntryPredic
>> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:63)
>>                         at
>> org.apache.ignite.internal.processors.cache.CacheEntryPredic
>> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:32)
>>                         at
>> org.apache.ignite.internal.processors.cache.GridCacheContext
>> .isAllLocked(GridCacheContext.java:1246)
>>                         ... 20 more
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>
>
>
> --
> Best regards,
> Andrey V. Mashenkov
>
>
>


-- 
Best regards,
Andrey V. Mashenkov

Re: BinaryObject model replace() in client/server topology fails with ClassNotFoundFunction

Posted by sai kiran nukala <sa...@gmail.com>.
Thanks for the reply.

How do I file a ticket ?

I know it is still early stage, usually how long it takes to fix this bug
and release a version because we need this functionality working for our
use case.

On Sep 7, 2017 10:22 PM, "Andrey Mashenkov" <an...@gmail.com>
wrote:

Hi,
Looks like a bug and CacheEntryPredicateContainsValue shouldn't deserialize
value to compare BinaryObjects in case of replace() operation.
Feel free to fill a ticket for this.



On Thu, Sep 7, 2017 at 9:50 AM, saikiran939 <sa...@gmail.com> wrote:

> Hi Team,
>
> Our team on working on a usecase in which we don't want to have any classes
> on Ignite Server node's classpath. To achieve this we are making use of
> BinaryObject based querying and putting/replacing values into cache.
>
> We are also using Optimistic Locking to replace the values into cache using
> "binaryObjectcache.replace(key, oldValue, newValue)" API - this method
> fails
> with ClassNotFoundException when used in client/server topology if the
> cache
> value class is not present at server's classpath. Sample piece of code is
> given below:
>
> String key = "key1";
> CacheValue entry1 = new CacheValue("putsomevalue");
> IgniteCache<String, CacheValue> cache = ignite.getOrCreateCache(cacheCfg);
> cache.put(key, entry1); //put works fine even if there is no class present
> in server's classpath
>
> CacheValue replaceEntry1 = cache.get(key);
> replaceEntry1.location= "test";
>
> IgniteCache<String, BinaryObject> binaryCacheProjection =
> cache.withKeepBinary();
> BinaryObject oldValueInBinary = binaryCacheProjection.get(key);
> BinaryObject newValueInBinary = ignite.binary().toBinary(replaceEntry1);
> binaryCacheProjection.replace(key, oldValueInBinary, newValueInBinary);
>
> The last replace() method call fails with below exception, is this bug in
> ignite because put() API works or is there anyway to workaround this
> exception ? I think from the stacktrace ignite server is trying to
> deserialize value object even if it is binary. I get the same exception
> with
> normal cache.replace() API .
>
> Exception in thread "main"
> org.apache.ignite.cache.CachePartialUpdateException: Failed to update keys
> (retry update if possible).: [OP21|SHARED]
>         at
> org.apache.ignite.internal.processors.cache.GridCacheUtils.c
> onvertToCacheException(GridCacheUtils.java:1488)
>         at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
> .cacheException(IgniteCacheProxy.java:2021)
>         at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy
> .replace(IgniteCacheProxy.java:1393)
>         at
> com.ignite.binary.TestReplaceBinaryObject.populateCache(Test
> ReplaceBinaryObject.java:166)
>         at
> com.ignite.binary.TestReplaceBinaryObject.main(TestReplaceBi
> naryObject.java:60)
>         at com.ignite.binary.IgniteDriver.main(IgniteDriver.java:11)
> Caused by: class
> org.apache.ignite.internal.processors.cache.CachePartialUpda
> teCheckedException:
> Failed to update keys (retry update if possible).: [OP21|SHARED]
>         at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridNearAtomicSingleUpdateFuture.onResult(GridNearAto
> micSingleUpdateFuture.java:232)
>         at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.processNearAtomicUpdateResponse(
> GridDhtAtomicCache.java:2969)
>         at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.access$700(GridDhtAtomicCache.java:130)
>         at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:274)
>         at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:272)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManag
> er.processMessage(GridCacheIoManager.java:748)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManag
> er.onMessage0(GridCacheIoManager.java:353)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManag
> er.handleMessage(GridCacheIoManager.java:277)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManag
> er.access$000(GridCacheIoManager.java:88)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManag
> er$1.onMessage(GridCacheIoManager.java:231)
>         at
> org.apache.ignite.internal.managers.communication.GridIoMana
> ger.invokeListener(GridIoManager.java:1238)
>         at
> org.apache.ignite.internal.managers.communication.GridIoMana
> ger.processRegularMessage0(GridIoManager.java:866)
>         at
> org.apache.ignite.internal.managers.communication.GridIoMana
> ger.access$1700(GridIoManager.java:106)
>         at
> org.apache.ignite.internal.managers.communication.GridIoMana
> ger$5.run(GridIoManager.java:829)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
> Executor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
> lExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:722)
>         Suppressed: class org.apache.ignite.IgniteCheckedException:
> Failed to
> update keys on primary node.
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridNearAtomicUpdateResponse.addFailedKey(GridNearAto
> micUpdateResponse.java:350)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2393)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAto
> micCache.java:1652)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtom
> icCache.java:1490)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest(
> GridDhtAtomicCache.java:2950)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.access$600(GridDhtAtomicCache.java:130)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:268)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:266)
>                 ... 12 more
>                 Suppressed: class org.apache.ignite.IgniteChecke
> dException:
> com.ignite.binary.CacheValue
>                         at
> org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7142)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheContext
> .isAllLocked(GridCacheContext.java:1252)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheMapEntr
> y.innerUpdate(GridCacheMapEntry.java:2241)
>                         at
> org.apache.ignite.internal.processors.cache.distributed.dht.
> atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2252)
>                         ... 18 more
>                 Caused by: java.lang.ClassNotFoundException:
> com.ignite.binary.CacheValue
>                         at java.net.URLClassLoader$1.run(
> URLClassLoader.java:366)
>                         at java.net.URLClassLoader$1.run(
> URLClassLoader.java:355)
>                         at java.security.AccessController.doPrivileged(Native
> Method)
>                         at java.net.URLClassLoader.findCl
> ass(URLClassLoader.java:354)
>                         at java.lang.ClassLoader.loadClas
> s(ClassLoader.java:423)
>                         at sun.misc.Launcher$AppClassLoad
> er.loadClass(Launcher.java:308)
>                         at java.lang.ClassLoader.loadClas
> s(ClassLoader.java:356)
>                         at java.lang.Class.forName0(Native Method)
>                         at java.lang.Class.forName(Class.java:266)
>                         at
> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8350)
>                         at
> org.apache.ignite.internal.MarshallerContextAdapter.getClass
> (MarshallerContextAdapter.java:185)
>                         at
> org.apache.ignite.internal.binary.BinaryContext.descriptorFo
> rTypeId(BinaryContext.java:662)
>                         at
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deseria
> lize(BinaryReaderExImpl.java:1474)
>                         at
> org.apache.ignite.internal.binary.BinaryObjectImpl.deseriali
> zeValue(BinaryObjectImpl.java:585)
>                         at
> org.apache.ignite.internal.binary.BinaryObjectImpl.value(Bin
> aryObjectImpl.java:142)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheUtils.
> value(GridCacheUtils.java:1512)
>                         at
> org.apache.ignite.internal.processors.cache.CacheEntryPredic
> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:63)
>                         at
> org.apache.ignite.internal.processors.cache.CacheEntryPredic
> ateContainsValue.apply(CacheEntryPredicateContainsValue.java:32)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheContext
> .isAllLocked(GridCacheContext.java:1246)
>                         ... 20 more
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov

Re: BinaryObject model replace() in client/server topology fails with ClassNotFoundFunction

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi,
Looks like a bug and CacheEntryPredicateContainsValue shouldn't deserialize
value to compare BinaryObjects in case of replace() operation.
Feel free to fill a ticket for this.



On Thu, Sep 7, 2017 at 9:50 AM, saikiran939 <sa...@gmail.com> wrote:

> Hi Team,
>
> Our team on working on a usecase in which we don't want to have any classes
> on Ignite Server node's classpath. To achieve this we are making use of
> BinaryObject based querying and putting/replacing values into cache.
>
> We are also using Optimistic Locking to replace the values into cache using
> "binaryObjectcache.replace(key, oldValue, newValue)" API - this method
> fails
> with ClassNotFoundException when used in client/server topology if the
> cache
> value class is not present at server's classpath. Sample piece of code is
> given below:
>
> String key = "key1";
> CacheValue entry1 = new CacheValue("putsomevalue");
> IgniteCache<String, CacheValue> cache = ignite.getOrCreateCache(cacheCfg);
> cache.put(key, entry1); //put works fine even if there is no class present
> in server's classpath
>
> CacheValue replaceEntry1 = cache.get(key);
> replaceEntry1.location= "test";
>
> IgniteCache<String, BinaryObject> binaryCacheProjection =
> cache.withKeepBinary();
> BinaryObject oldValueInBinary = binaryCacheProjection.get(key);
> BinaryObject newValueInBinary = ignite.binary().toBinary(replaceEntry1);
> binaryCacheProjection.replace(key, oldValueInBinary, newValueInBinary);
>
> The last replace() method call fails with below exception, is this bug in
> ignite because put() API works or is there anyway to workaround this
> exception ? I think from the stacktrace ignite server is trying to
> deserialize value object even if it is binary. I get the same exception
> with
> normal cache.replace() API .
>
> Exception in thread "main"
> org.apache.ignite.cache.CachePartialUpdateException: Failed to update keys
> (retry update if possible).: [OP21|SHARED]
>         at
> org.apache.ignite.internal.processors.cache.GridCacheUtils.
> convertToCacheException(GridCacheUtils.java:1488)
>         at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy.
> cacheException(IgniteCacheProxy.java:2021)
>         at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy.replace(
> IgniteCacheProxy.java:1393)
>         at
> com.ignite.binary.TestReplaceBinaryObject.populateCache(
> TestReplaceBinaryObject.java:166)
>         at
> com.ignite.binary.TestReplaceBinaryObject.main(
> TestReplaceBinaryObject.java:60)
>         at com.ignite.binary.IgniteDriver.main(IgniteDriver.java:11)
> Caused by: class
> org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedExcep
> tion:
> Failed to update keys (retry update if possible).: [OP21|SHARED]
>         at
> org.apache.ignite.internal.processors.cache.distributed.dht.atomic.
> GridNearAtomicSingleUpdateFuture.onResult(GridNearAtomicSingleUpdateFutu
> re.java:232)
>         at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.processNearAtomicUpdateRespons
> e(GridDhtAtomicCache.java:2969)
>         at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.access$700(GridDhtAtomicCache.java:130)
>         at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:274)
>         at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:272)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.
> processMessage(GridCacheIoManager.java:748)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(
> GridCacheIoManager.java:353)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.
> handleMessage(GridCacheIoManager.java:277)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$000(
> GridCacheIoManager.java:88)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.
> onMessage(GridCacheIoManager.java:231)
>         at
> org.apache.ignite.internal.managers.communication.
> GridIoManager.invokeListener(GridIoManager.java:1238)
>         at
> org.apache.ignite.internal.managers.communication.GridIoManager.
> processRegularMessage0(GridIoManager.java:866)
>         at
> org.apache.ignite.internal.managers.communication.
> GridIoManager.access$1700(GridIoManager.java:106)
>         at
> org.apache.ignite.internal.managers.communication.GridIoManager$5.run(
> GridIoManager.java:829)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:722)
>         Suppressed: class org.apache.ignite.IgniteCheckedException:
> Failed to
> update keys on primary node.
>                 at
> org.apache.ignite.internal.processors.cache.distributed.dht.atomic.
> GridNearAtomicUpdateResponse.addFailedKey(GridNearAtomicUpdateResponse.
> java:350)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2393)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal0(
> GridDhtAtomicCache.java:1652)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal(
> GridDhtAtomicCache.java:1490)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest
> (GridDhtAtomicCache.java:2950)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.access$600(GridDhtAtomicCache.java:130)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:268)
>                 at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:266)
>                 ... 12 more
>                 Suppressed: class org.apache.ignite.
> IgniteCheckedException:
> com.ignite.binary.CacheValue
>                         at
> org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7142)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheContext.isAllLocked(
> GridCacheContext.java:1252)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheMapEntry.innerUpdate(
> GridCacheMapEntry.java:2241)
>                         at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2252)
>                         ... 18 more
>                 Caused by: java.lang.ClassNotFoundException:
> com.ignite.binary.CacheValue
>                         at java.net.URLClassLoader$1.run(
> URLClassLoader.java:366)
>                         at java.net.URLClassLoader$1.run(
> URLClassLoader.java:355)
>                         at java.security.AccessController.doPrivileged(Native
> Method)
>                         at java.net.URLClassLoader.
> findClass(URLClassLoader.java:354)
>                         at java.lang.ClassLoader.
> loadClass(ClassLoader.java:423)
>                         at sun.misc.Launcher$AppClassLoader.loadClass(
> Launcher.java:308)
>                         at java.lang.ClassLoader.
> loadClass(ClassLoader.java:356)
>                         at java.lang.Class.forName0(Native Method)
>                         at java.lang.Class.forName(Class.java:266)
>                         at
> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8350)
>                         at
> org.apache.ignite.internal.MarshallerContextAdapter.getClass(
> MarshallerContextAdapter.java:185)
>                         at
> org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(
> BinaryContext.java:662)
>                         at
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(
> BinaryReaderExImpl.java:1474)
>                         at
> org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(
> BinaryObjectImpl.java:585)
>                         at
> org.apache.ignite.internal.binary.BinaryObjectImpl.value(
> BinaryObjectImpl.java:142)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheUtils.value(
> GridCacheUtils.java:1512)
>                         at
> org.apache.ignite.internal.processors.cache.CacheEntryPredicateContainsVal
> ue.apply(CacheEntryPredicateContainsValue.java:63)
>                         at
> org.apache.ignite.internal.processors.cache.CacheEntryPredicateContainsVal
> ue.apply(CacheEntryPredicateContainsValue.java:32)
>                         at
> org.apache.ignite.internal.processors.cache.GridCacheContext.isAllLocked(
> GridCacheContext.java:1246)
>                         ... 20 more
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov