ignite - Delta operation on Cache -
getting error while trying perform delta operation on basic primitype type on objects
@test public void testdeltaonfield() { string name = "sreehari"; roccacheconfiguration<string, string> rc1 = new roccacheconfiguration<>(); rc1.setname("seventhcache"); roccache<string, string> r1 = roccachemanager.createcache(rc1); r1.put("a", name); assertequals(r1.get("a"), "sreehari"); roccachemanager.withkeepbinary(r1.getname()).invoke("a", (entry, args) -> { string = (string) entry.getvalue(); entry.setvalue(a = "hari"); return null; }); assertequals(r1.get("a"), "hari"); r1.replace("a", "hari", "hari1"); assertequals(r1.get("a"), "hari1"); roccachemanager.destroycache("seventhcache"); } @test public void testdeltaonpojofields() { testpojo t1 = new testpojo(1, "sreehari1"); testpojo t2 = new testpojo(2, "hari1"); testpojo t3 = new testpojo(3, "sreehari2"); testpojo t4 = new testpojo(4, "hari2"); testpojo t5 = new testpojo(5, "sreehari3"); testpojo t6 = new testpojo(6, "hari3"); testpojo t7 = new testpojo(7, "sreehari4"); testpojo t8 = new testpojo(8, "hari4"); roccacheconfiguration<string, testpojo> rc1 = new roccacheconfiguration<>(); rc1.setname("eighthcache"); roccache<string, testpojo> r1 = roccachemanager.createcache(rc1); r1.put("a", t1); r1.put("b", t2); r1.put("c", t3); r1.put("d", t4); assertequals(r1.get("a").getname(), "sreehari1"); roccachemanager.withkeepbinary(r1.getname()).invoke("a", (entry, args) -> { binaryobjectbuilder bldr = ((binaryobject) entry.getvalue()).tobuilder(); // update field in builder. bldr.setfield("name", "sreehari3"); int val = bldr.getfield("id"); bldr.setfield("id", val + 1); // set new value entry. entry.setvalue(bldr.build()); return null; }); assertequals(r1.get("a").getname(), "sreehari3"); assertequals(r1.get("a").getid(), 2); roccachemanager.destroycache("eighthcache"); } @test public void testdeltaonallpojofields() { set<string> key = new hashset<string>(); key.add("a"); key.add("b"); key.add("c"); key.add("d"); testpojo t1 = new testpojo(1, "sreehari1"); testpojo t2 = new testpojo(2, "hari1"); testpojo t3 = new testpojo(3, "sreehari2"); testpojo t4 = new testpojo(4, "hari2"); roccacheconfiguration<string, testpojo> rc1 = new roccacheconfiguration<>(); rc1.setname("ninethcache"); roccache<string, testpojo> r1 = roccachemanager.createcache(rc1); r1.put("a", t1); r1.put("b", t2); r1.put("c", t3); r1.put("d", t4); assertequals(r1.get("a").getname(), "sreehari1"); roccachemanager.withkeepbinary(r1.getname()).invokeall(key, (entry, args) -> { binaryobjectbuilder bldr = ((binaryobject) entry.getvalue()).tobuilder(); // update field in builder. bldr.setfield("name", "sreehari3"); // set new value entry. entry.setvalue(bldr.build()); return null; }); assertequals(r1.get("b").getname(), "sreehari3"); roccachemanager.destroycache("eigthcache"); r1.replace("b", t1); assertequals(r1.get("b").getname(), "sreehari1"); roccachemanager.destroycache("nineththcache"); } @test public void testdeltaonalllistofpojofields() { set<string> key = new hashset<string>(); key.add("a"); key.add("b"); key.add("c"); key.add("d"); testpojo t1 = new testpojo(1, "sreehari1"); testpojo t2 = new testpojo(2, "hari1"); testpojo t3 = new testpojo(3, "sreehari2"); testpojo t4 = new testpojo(4, "hari2"); testpojo t5 = new testpojo(5, "sreehari3"); testpojo t6 = new testpojo(6, "hari3"); testpojo t7 = new testpojo(7, "sreehari4"); testpojo t8 = new testpojo(8, "hari4"); list<testpojo> listob1 = new arraylist<testpojo>(); listob1.add(t1); listob1.add(t2); list<testpojo> listob2 = new arraylist<testpojo>(); listob2.add(t3); listob2.add(t4); list<testpojo> listob3 = new arraylist<testpojo>(); listob3.add(t5); listob3.add(t6); list<testpojo> listob4 = new arraylist<testpojo>(); listob4.add(t7); listob4.add(t8); map<string, list<testpojo>> igmap = new hashmap<string, list<testpojo>>(); igmap.put("a", listob1); igmap.put("b", listob2); igmap.put("c", listob3); igmap.put("d", listob4); roccacheconfiguration<string, list<testpojo>> rc1 = new roccacheconfiguration<>(); rc1.setname("tenthcache"); roccache<string, list<testpojo>> r1 = (roccache<string, list<testpojo>>) roccachemanager.createcache(rc1); r1.putall(igmap); roccachemanager.withkeepbinary(r1.getname()).invokeall(key, (entry, args) -> { binaryobjectbuilder bldr = ((binaryobject) entry.getvalue()).tobuilder(); // update field in builder. bldr.setfield("name", "sreehari3"); // set new value entry. entry.setvalue(bldr.build()); return null; }); assertequals(r1.getall(key).get("a").get(0).getname(), "sreehari1"); roccachemanager.destroycache("tenthcache"); } error stack trace follows
javax.cache.cacheexception: class org.apache.ignite.ignitecheckedexception:cache.roccachetest$$lambda$9/1985869725 @ org.apache.ignite.internal.processors.cache.gridcacheutils.converttocacheexception(gridcacheutils.java:1618) @ org.apache.ignite.internal.processors.cache.ignitecacheproxy.cacheexception(ignitecacheproxy.java:1841) @ org.apache.ignite.internal.processors.cache.ignitecacheproxy.invokeall(ignitecacheproxy.java:1544) @ cache.roccache.invokeall(roccache.java:129) @ cache.roccachetest.testdeltaonalllistofpojofields(roccachetest.java:529) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:50) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:47) @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:17) @ org.springframework.test.context.junit4.statements.runbeforetestmethodcallbacks.evaluate(runbeforetestmethodcallbacks.java:75) @ org.springframework.test.context.junit4.statements.runaftertestmethodcallbacks.evaluate(runaftertestmethodcallbacks.java:86) @ org.springframework.test.context.junit4.statements.springrepeat.evaluate(springrepeat.java:84) @ org.junit.runners.parentrunner.runleaf(parentrunner.java:325) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:254) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:89) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.springframework.test.context.junit4.statements.runbeforetestclasscallbacks.evaluate(runbeforetestclasscallbacks.java:61) @ org.springframework.test.context.junit4.statements.runaftertestclasscallbacks.evaluate(runaftertestclasscallbacks.java:70) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.springframework.test.context.junit4.springjunit4classrunner.run(springjunit4classrunner.java:193) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:86) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:459) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:675) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:382) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:192) caused by: class org.apache.ignite.ignitecheckedexception: cache.roccachetest$$lambda$9/1985869725 @ org.apache.ignite.internal.processors.cache.gridcacheiomanager.unmarshall(gridcacheiomanager.java:1044) @ org.apache.ignite.internal.processors.cache.gridcacheiomanager.onmessage0(gridcacheiomanager.java:275) @ org.apache.ignite.internal.processors.cache.gridcacheiomanager.handlemessage(gridcacheiomanager.java:204) @ org.apache.ignite.internal.processors.cache.gridcacheiomanager.access$000(gridcacheiomanager.java:80) @ org.apache.ignite.internal.processors.cache.gridcacheiomanager$1.onmessage(gridcacheiomanager.java:163) @ org.apache.ignite.internal.managers.communication.gridiomanager.processregularmessage0(gridiomanager.java:821) @ org.apache.ignite.internal.managers.communication.gridiomanager.access$1600(gridiomanager.java:103) @ org.apache.ignite.internal.managers.communication.gridiomanager$5.run(gridiomanager.java:784) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: class org.apache.ignite.binary.binaryinvalidtypeexception: cache.roccachetest$$lambda$9/1985869725 @ org.apache.ignite.internal.binary.binarycontext.descriptorfortypeid(binarycontext.java:492) @ org.apache.ignite.internal.binary.binarycontext.descriptorfortypeid(binarycontext.java:489) @ org.apache.ignite.internal.binary.binaryreadereximpl.deserialize(binaryreadereximpl.java:1443) @ org.apache.ignite.internal.binary.gridbinarymarshaller.deserialize(gridbinarymarshaller.java:292) @ org.apache.ignite.internal.binary.binarymarshaller.unmarshal(binarymarshaller.java:112) @ org.apache.ignite.internal.processors.cache.gridcachemessage.unmarshalcollection(gridcachemessage.java:606) @ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.gridnearatomicupdaterequest.finishunmarshal(gridnearatomicupdaterequest.java:621) @ org.apache.ignite.internal.processors.cache.gridcacheiomanager.unmarshall(gridcacheiomanager.java:1038) ... 10 more caused by: java.lang.classnotfoundexception: cache.roccachetest$$lambda$9/1985869725 @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:340) @ org.apache.ignite.internal.util.igniteutils.forname(igniteutils.java:8172) @ org.apache.ignite.internal.marshallercontextadapter.getclass(marshallercontextadapter.java:185) @ org.apache.ignite.internal.binary.binarycontext.descriptorfortypeid(binarycontext.java:483) ... 17 more
earlier tests running fine. after trying having client , server setup tests failing , , tests failing when same 2 systems used servers or when config in server mode.
config follows
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <!-- datasource sample in-memory h2 database. --> <bean id="h2-example-db" class="org.h2.jdbcx.jdbcdatasource"> <property name="url" value="jdbc:h2:tcp://localhost/mem:exampledb" /> <property name="user" value="sa" /> </bean> <bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.igniteconfiguration"> <!-- set true enable distributed class loading examples, default false. --> <property name="peerclassloadingenabled" value="false" /> <!-- enable task execution events examples. --> <property name="includeeventtypes"> <list> <!--task execution events --> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_started" /> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_finished" /> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_failed" /> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_timedout" /> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_session_attr_set" /> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_reduced" /> <!--cache events --> <util:constant static-field="org.apache.ignite.events.eventtype.evt_cache_object_put" /> <util:constant static-field="org.apache.ignite.events.eventtype.evt_cache_object_read" /> <util:constant static-field="org.apache.ignite.events.eventtype.evt_cache_object_removed" /> </list> </property> <!-- explicitly configure tcp discovery spi provide list of initial nodes. --> <property name="discoveryspi"> <bean class="org.apache.ignite.spi.discovery.tcp.tcpdiscoveryspi"> <property name="jointimeout" value="60000" /> <property name="ipfinder"> <!-- ignite provides several options automatic discovery can used instead os static ip based discovery. information on options refer our documentation: http://apacheignite.readme.io/docs/cluster-config --> <!-- uncomment static ip finder enable static-based discovery of initial nodes. --> <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.tcpdiscoveryvmipfinder"> --> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.tcpdiscoveryvmipfinder"> <!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.tcpdiscoverymulticastipfinder"> --> <property name="addresses"> <list> <!-- in distributed environment, replace actual host ip address. --> <value>10.113.56.231:47500..47509</value> <value>10.113.56.110:47500..47509</value> </list> </property> </bean> </property> </bean> </property> <!-- property name="marshaller"> <bean class="com.esotericsoftware.kryo.serializers.defaultserializers"> <property name="requireserializable" value="false" /> </bean> </property --> <!--property name="binaryconfiguration"> <bean class="org.apache.ignite.configuration.binaryconfiguration"> <property name="typeconfigurations"> <list> <bean class="org.apache.ignite.binary.binarytypeconfiguration"> <property name="typename" value="testpojo" /> <property name="serializer"> <bean class="com.esotericsoftware.kryo.serializers.defaultserializers" /> </property> </bean> </list> </property> </bean> </property --> </bean> </beans>
looks there nodes in topology don't have required classes on classpath. in case have deploy class declares entry processor lambda.
another option switch on peer class loading:
<property name="peerclassloadingenabled" value="true"/>
Comments
Post a Comment