ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgarg <pg...@gridgain.com>
Subject Re: Connecting to existing grid
Date Sat, 09 May 2015 19:43:07 GMT
/commented by mike charnoky/

Thanks for the quick response Dmitriy, I guess that operation wasn't so
obvious. Glad that you are adding functionality to make this operation
simpler. I was finally able to get a simple example working in this mode
with an /IgniteCache<String, String>/. My goal was to connect to a grid over
the network without the use of config files, so I used the
/TcpDiscoverySpi/. However, when I tried to use my own custom /Serializable/
keys/value, the following error was logged from the server node:

/[10:46:04,525][SEVERE][ignite-#19%sys-null%][GridCacheIoManager] Failed to
process message (note that distributed services do not support peer class
loading, if you deploy distributed service you should have all required
classes in CLASSPATH on all nodes in topology)
[senderId=6e0c6104-3c92-4ed8-8548-e3636ce1859c, err=Failed to load class
[name=MyKey, ctx={}]]/

Does the server really need to have access to all the classes that will be
stored in caches? I've never seen this sort of requirement for other data
grid products like Infinispan or Hazelcast. Is there an easy way to manage
this dependency?

Here is the code I am using to create a simple client, obtain a reference to
a cache, then do a simple put() and get(). Note that the server is running
using /default-config.xml/.

/String cacheId = "partitioned"; 
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
IgniteConfiguration cfg = new IgniteConfiguration();
CacheConfiguration<MyKey, MyValue> cacheCfg = new CacheConfiguration<MyKey,
// Required to fix "Cache mode mismatch" exception
// Run local node as client only
Ignite ignite = Ignition.start(cfg);
IgniteCache<MyKey, MyValue> cache = ignite.jcache(cacheId);    
MyKey key = new MyKey("customer1", "value1");
MyValue val = new MyValue("data1", "data2");
cache.put(key, val);
MyValue val2 = cache.get(key);

/This post is migrated from now discontinued Apache Ignite forum at 

View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Connecting-to-existing-grid-tp283p285.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

View raw message