Hi,

Could you please clarify what is ROCCache and ROCCacheConfiguration? And
how many nodes do you have in topology?

Vladimir.

On Thu, Apr 21, 2016 at 10:34 AM, abhishek94 <[email protected]>
wrote:

> 1 client node and 1 remote server node, have added the Pojo jar and MYSQl
> jar
> in the remote node libs but still the loadcache throws an nullpointer
> exception.
>
> The code  is as follows
>
>   @Test
>   public void testClusterNormalCache() {
>     Connection con = null;
>     Statement stmt = null;
>     String sql = null;
>     IgniteCluster igniteCluster = rocCachemanager.getCluster();
>     HashMap<String, Object> defaults = new HashMap<String, Object>();
>     HashMap<String, Object> hmLocal = new HashMap<String, Object>();
>     hmLocal.put("host", "10.113.56.231");
>     hmLocal.put("port", 22);
>     defaults.put("port", 22);
>     hmLocal.put("uname", "root");
>     hmLocal.put("passwd", "root123");
>     hmLocal.put("nodes", 1);
>     hmLocal.put("igniteHome",
> "/home/benakaraj/Downloads/apache-ignite-fabric-1.5.0.final-bin");
>     hmLocal.put("cfg", "conf/spring_igniteConfig.xml");
>     Collection<Map&lt;String, Object>> hosts = new ArrayList<Map&lt;String,
> Object>>();
>     hosts.add(hmLocal);
>     try {
>       Collection<ClusterStartNodeResult> result =
> igniteCluster.startNodes(hosts, defaults, true, 10000, 2);
>       int waitTime = 0;
>       while (waitTime < 15000) {
>         synchronized (this) {
>
>           try {
>             wait(2000);
>           } catch (InterruptedException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>           }
>         }
>
>         waitTime += 2000;
>       }
>       Collection<UUID> ids = new ArrayList<UUID>();
>       for (ClusterStartNodeResult res : result) {
>         if (!res.isSuccess())
>           System.out.println(res.getError());
>         else {
>           System.out.println(res.getHostName());
>           ClusterMetrics metrics = igniteCluster.metrics();
>           ClusterGroup group = igniteCluster.forRemotes();
>           // ClusterNode node=group.node();
>           Collection<ClusterNode> nodes = group.nodes();
>           System.out.println("Nodes--" + nodes.size());
>           for (ClusterNode node : nodes) {
>             ids.add(node.id());
>             Map<String, Object> hm = node.attributes();
>             for (java.util.Map.Entry<String, Object> entry : hm.entrySet())
> {
>               // System.out.println(entry.getKey()+"---"+entry.getValue());
>             }
>
>
> System.out.println("------------------------------------------------");
>
> System.out.println("------------------------------------------------");
>
> System.out.println("------------------------------------------------");
>
> System.out.println("------------------------------------------------");
>
>           }
>
>
>         }
>       }
>       try {
>         con = ds.getConnection();
>
>         stmt = con.createStatement();
>         sql = "create table Organization(org_id int,org_name
> varchar(20),primary key(org_id))";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(1,'Subex')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(2,'Informatica')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(3,'SAP')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(4,'William O Niel')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(5,'Subex1')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(6,'Informatica1')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(7,'SAP1')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(8,'William O Niel1')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(9,'Subex2')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(10,'Informatica2')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(11,'SAP2')";
>         stmt.executeUpdate(sql);
>         sql = "insert into Organization values(12,'William O Niel2')";
>         stmt.executeUpdate(sql);
>       } catch (Exception e) {
>       }
>
>       try {
>
>         ROCCacheConfiguration<Integer, Organization> new4 = new
> ROCCacheConfiguration<>();
>         new4.setName("loadCacheAll");
>         new4.setCacheMode(CacheMode.REPLICATED);
>         new4.setReadThrough(true);
>         new4.setWriteThrough(true);
>         JdbcType jdbcType = new JdbcType();
>
>         jdbcType.setCacheName("loadCacheAll");
>
>         jdbcType.setDatabaseSchema(con.getCatalog());
>
>         jdbcType.setDatabaseTable("Organization");
>         jdbcType.setKeyType(Integer.class);
>         jdbcType.setValueType(Organization.class); // Key fields for
> PERSON.
>
>         Collection<JdbcTypeField> keys = new ArrayList<>();
>         keys.add(new JdbcTypeField(Types.INTEGER, "org_id", int.class,
> "orgId"));
>         jdbcType.setKeyFields(keys.toArray(new
> JdbcTypeField[keys.size()]));
>
>         // Value fields for ORGANIZATION.
>         Collection<JdbcTypeField> vals = new ArrayList<>();
>         vals.add(new JdbcTypeField(Types.INTEGER, "org_id", int.class,
> "orgId"));
>         vals.add(new JdbcTypeField(Types.VARCHAR, "org_name", String.class,
> "orgName"));
>         jdbcType.setValueFields(vals.toArray(new
> JdbcTypeField[vals.size()]));
>
>
>         // Indexes for ORGANIZATION.
>         Collection<QueryIndex> idxs = new ArrayList<>();
>
>         idxs.add(new QueryIndex("orgId", true, "PRIMARY_KEY"));
>
>         Collection<JdbcType> jdbcTypes = new ArrayList<>();
>
>         jdbcTypes.add(jdbcType);
>
>         @SuppressWarnings("unchecked")
>         CacheJdbcPojoStoreFactory<Integer, Organization>
> cacheJdbcdPojoStorefactory3 =
>             context.getBean(CacheJdbcPojoStoreFactory.class);
>         cacheJdbcdPojoStorefactory3.setTypes(jdbcTypes.toArray(new
> JdbcType[jdbcTypes.size()]));
>
>         new4.setCacheStoreFactory((Factory<? extends CacheStore<Integer,
> Organization>>) cacheJdbcdPojoStorefactory3);
>
>         ROCCache<Integer, Organization> orgCache5 =
> rocCachemanager.createCache(new4);
>
>         orgCache5.loadCache(null);
>         /*
>          * assertEquals(orgCache5.get(1).getOrgName(), "Subex");
> assertEquals(orgCache5.get(5).getOrgName(), "Subex1");
>          * assertEquals(orgCache5.get(9).getOrgName(), "Subex2");
>          */
>
>
>         sql = "drop table Organization";
>         stmt.executeUpdate(sql);
>         rocCachemanager.destroyCache("loadCacheAll");
>       } catch (SQLException e1) {
>         // TODO Auto-generated catch block
>         e1.printStackTrace();
>       }
>     } finally {
>       try {
>         stmt.close();
>         con.close();
>       } catch (SQLException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>       }
>     }
>   }
>
>
>
>
>
> Error Log
>
>
> Topology snapshot [ver=1, servers=0, clients=1, CPUs=8, heap=1.7GB]
> Starting remote node with SSH command: nohup
>
> "/home/benakaraj/Downloads/apache-ignite-fabric-1.5.0.final-bin/bin/ignite.sh"
> -v "conf/spring_igniteConfig.xml" -J-DIGNITE_SSH_HOST="10.113.56.231"
> -J-DIGNITE_SSH_USER_NAME="root" >
> ignite-startNodes/04-21-2016--12-58-57-f79ccd6d.log 2>& 1 &
> Your version is up to date.
> Local java version is different from remote [loc=8, rmt=7]
> Added new node to topology: TcpDiscoveryNode
> [id=e3fbfaa6-fcb6-4640-9880-f48ca7d52203, addrs=[0:0:0:0:0:0:0:1%1,
> 10.113.56.231, 127.0.0.1, 192.168.122.1], sockAddrs=[/192.168.122.1:47500,
> /0:0:0:0:0:0:0:1%1:47500, /10.113.56.231:47500, /10.113.56.231:47500,
> /127.0.0.1:47500, /192.168.122.1:47500], discPort=47500, order=2,
> intOrder=2, lastExchangeTime=1461223739785, loc=false,
> ver=1.5.0#20151229-sha1:f1f8cda2, isClient=false]
> Topology snapshot [ver=2, servers=1, clients=1, CPUs=16, heap=2.7GB]
> 10.113.56.231
> Nodes--1
> ------------------------------------------------
> ------------------------------------------------
> ------------------------------------------------
> ------------------------------------------------
> Started cache [name=loadCacheAll, mode=REPLICATED]
> Failed to obtain remote job result policy for result from
> ComputeTask.result(..) method (will fail the whole task): GridJobResultImpl
> [job=C2 [], sib=GridJobSiblingImpl
> [sesId=ac6c8b73451-ac2b2c23-8165-428e-bdfc-aa728c1de80e,
> jobId=dc6c8b73451-e3fbfaa6-fcb6-4640-9880-f48ca7d52203,
> nodeId=e3fbfaa6-fcb6-4640-9880-f48ca7d52203, isJobDone=false],
> jobCtx=GridJobContextImpl
> [jobId=dc6c8b73451-e3fbfaa6-fcb6-4640-9880-f48ca7d52203, timeoutObj=null,
> attrs={}], node=TcpDiscoveryNode [id=e3fbfaa6-fcb6-4640-9880-f48ca7d52203,
> addrs=[0:0:0:0:0:0:0:1%1, 10.113.56.231, 127.0.0.1, 192.168.122.1],
> sockAddrs=[/192.168.122.1:47500, /0:0:0:0:0:0:0:1%1:47500,
> /10.113.56.231:47500, /10.113.56.231:47500, /127.0.0.1:47500,
> /192.168.122.1:47500], discPort=47500, order=2, intOrder=2,
> lastExchangeTime=1461223739785, loc=false,
> ver=1.5.0#20151229-sha1:f1f8cda2,
> isClient=false], ex=class o.a.i.IgniteException: null, hasRes=true,
> isCancelled=false, isOccupied=true]
> class org.apache.ignite.IgniteException: Remote job threw user exception
> (override or implement ComputeTask.result(..) method if you would like to
> have automatic failover for this exception).
>         at
>
> org.apache.ignite.compute.ComputeTaskAdapter.result(ComputeTaskAdapter.java:101)
>         at
>
> org.apache.ignite.internal.processors.task.GridTaskWorker$3.apply(GridTaskWorker.java:909)
>         at
>
> org.apache.ignite.internal.processors.task.GridTaskWorker$3.apply(GridTaskWorker.java:902)
>         at
>
> org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6429)
>         at
>
> org.apache.ignite.internal.processors.task.GridTaskWorker.result(GridTaskWorker.java:902)
>         at
>
> org.apache.ignite.internal.processors.task.GridTaskWorker.onResponse(GridTaskWorker.java:798)
>         at
>
> org.apache.ignite.internal.processors.task.GridTaskProcessor.processJobExecuteResponse(GridTaskProcessor.java:995)
>         at
>
> org.apache.ignite.internal.processors.task.GridTaskProcessor$JobMessageListener.onMessage(GridTaskProcessor.java:1219)
>         at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:821)
>         at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.access$1600(GridIoManager.java:103)
>         at
>
> org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:784)
>         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.IgniteException: null
>         at
>
> org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1792)
>         at
>
> org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:509)
>         at
>
> org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6397)
>         at
>
> org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:503)
>         at
>
> org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:456)
>         at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
>         at
>
> org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1166)
>         at
>
> org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1770)
>         at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:821)
>         at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.access$1600(GridIoManager.java:103)
>         at
>
> org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:784)
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         ... 1 more
> Caused by: java.lang.NullPointerException
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheClosure.call(GridCacheAdapter.java:5769)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheClosure.call(GridCacheAdapter.java:5716)
>         at
>
> org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.execute(GridClosureProcessor.java:1789)
>         ... 13 more
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Getting-a-null-pointer-exception-when-trying-to-bulk-load-a-cache-using-LoadCache-tp4406.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to