Hi,
You should remove definition of the cache from IgniteConfiguration:
Ignition.setClientMode(true);
IgniteConfiguration igniteConfiguration = new
IgniteConfiguration().setGridName("experiments");
Ignite client = Ignition.start(igniteConfiguration);
IgniteCache<Object, Object> nearCache =
client.getOrCreateNearCache("sample", new NearCacheConfiguration<>());
Did this helped?
2016-05-04 17:37 GMT+03:00 zshamrock <[email protected]>:
> Based on the discussion in Gitter it was proposed to ask a question here.
>
> package experiments.ignite;
>
> import org.apache.ignite.Ignite;
> import org.apache.ignite.Ignition;
> import org.apache.ignite.configuration.CacheConfiguration;
> import org.apache.ignite.configuration.IgniteConfiguration;
> import org.apache.ignite.configuration.NearCacheConfiguration;
>
> public class ClientNearCache {
>
> public static void main(String[] args) {
> final CacheConfiguration<String, String> cacheConfiguration = new
> CacheConfiguration<>("sample");
>
> final IgniteConfiguration igniteConfiguration = new
> IgniteConfiguration()
> .setGridName("experiments")
> .setCacheConfiguration(cacheConfiguration);
>
> Ignition.setClientMode(true);
> final Ignite client = Ignition.start(igniteConfiguration);
> client.createNearCache("sample", new NearCacheConfiguration<>());
> }
> }
>
>
> The code above fails with the following error (there is a server node
> running in another process):
>
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to start
> near cache (a cache with the same name without near cache is already
> started)
> at
>
> org.apache.ignite.internal.IgniteKernal.checkNearCacheStarted(IgniteKernal.java:2593)
> at
>
> org.apache.ignite.internal.IgniteKernal.createNearCache(IgniteKernal.java:2545)
> ... 6 more
>
> My expectations would be, that according to
>
> https://apacheignite.readme.io/docs/clients-vs-servers#creating-distributed-caches
> ,
> calling Ignition.start(igniteConfiguration) first time, will create a
> distributed server cache. And client.createNearCache() will create the near
> cache for that specific node's client.
>
> Is it a potential bug, or an expected behavior?
>
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-near-cache-conflicts-with-server-distributed-cache-tp4768.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>
--
Best regards,
Alexei Scherbakov