ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saikiran939 <saikiran...@gmail.com>
Subject BinaryObject model replace() in client/server topology fails with ClassNotFoundFunction
Date Thu, 07 Sep 2017 06:50:31 GMT
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/

Mime
View raw message