0
votes

I am trying to use voldemort store to persist data in hazelcast. I implemented the mapstore interface. When i try to add a map entry in hazelcast i get this exception.

29 Mar, 2012 12:19:28 PM com.hazelcast.cluster.ClusterService
SEVERE: /192.168.100.120:5701 [dev] error processing messages  processable=com.hazelcast.cluster.ClusterService$1@561777b1
java.lang.NoClassDefFoundError: voldemort/client/StoreClientFactory
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2406)
    at java.lang.Class.getConstructor0(Class.java:2716)
    at java.lang.Class.newInstance0(Class.java:343)
    at java.lang.Class.newInstance(Class.java:325)
    at com.hazelcast.impl.CMap.<init>(CMap.java:203)
    at com.hazelcast.impl.ConcurrentMapManager.getOrCreateMap(ConcurrentMapManager.java:2160)
    at com.hazelcast.impl.FactoryImpl.createProxy(FactoryImpl.java:735)
    at com.hazelcast.impl.FactoryImpl$7.process(FactoryImpl.java:809)
    at com.hazelcast.cluster.ClusterService$1.process(ClusterService.java:126)
    at com.hazelcast.cluster.ClusterService.processProcessable(ClusterService.java:190)
    at com.hazelcast.cluster.ClusterService.dequeueProcessables(ClusterService.java:256)
    at com.hazelcast.cluster.ClusterService.run(ClusterService.java:201)
    at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.ClassNotFoundException: voldemort.client.StoreClientFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 14 more

This is the hazelcast run.sh script i've edited in order to include voldemort jars in the classpath.

#!/bin/sh
java -Djava.net.preferIPv4Stack=true -cp     ./:/home/gerrard/workspace/hazelcast/bin/:/home/gerrard/work/voldemort-    0.90.1/lib/:/home/gerrard/work/voldemort-0.90.1/dist/:/home/gerrard/work/voldemort-    0.90.1/bin/:../lib/hazelcast-2.0.1.jar com.hazelcast.examples.TestApp

I've also added my implementation class in the hazelcast.xml file.

I've also added a classpath entry in the manifest file of hazelcast-2.0.1.jar.

Even then, when i try to add an entry it gives this noclassdef found error. The class its trying to find is definitely in the voldemort folder that i've added to the classpath. I still do not have a clue as to what the problem is. Can somebody suggest any alternative solutions ? Thanks.

1

1 Answers

1
votes

You can try Hazelcast Config and set the Factory object yourself.

// Build the config from xml file you have in the classpath
Config config = new XmlConfigBuilder().build();
MapStoreConfig msc = new MapStoreConfig..
msc.setFactoryImplementation(new StoreClientFactory());
MapConfig mapConfig = new MapConfig..
mapConfig.setMapStoreConfig(msc);
config.addMapConfig(mapconfig);

// init Hazelcast with this configuration
// make sure you call init fore any other Hazelcast operation!!
Hazelcast.init(config);

// then access to your map
Map map = Hazelcast.getMap("mymap");