I'm trying to use Hazelcast and Spring 3.0
Can someone help me out with bean definition for client ?
Here is my client definition
<bean id="ClientInstance"
class="com.hazelcast.client.HazelcastClient" factory-
method="newHazelcastInstance">
<constructor-arg value="group" />
<constructor-arg value="password" />
<constructor-arg>
<list>
<value>127.0.01:5701</value>
</list>
</constructor-arg>
</bean>
<bean id="hazelcastClientProvider"
class="com.usamp.caching.provider.impl.HazelcastClientProvider">
<property name="hcClientInstance" ref="ClientInstance"/>
</bean>
my class has this client instance defined
private com.hazelcast.core.HazelcastInstance hcClientInstance;
@Required
public void
setHcClientInstance(com.hazelcast.core.HazelcastInstance
hcClientInstance) {
this.hcClientInstance = hcClientInstance;
}
What am I doing wrong ? I'm getting exception that no constuctor found
which matches this signature.. but I can see that there is a
constructor
public static HazelcastClient newHazelcastClient(String groupName,
String groupPassword, String[] addresses) {
//compiled code
throw new RuntimeException("Compiled Code");
}
inside HazelcastClient class
Then I've tried to call this constructor
public static HazelcastClient newHazelcastClient(ClientProperties
properties, List<String> addresses) {
this is my bean definition
<bean id="ClientInstanceProperties"
class="com.hazelcast.client.ClientProperties." >
<property name="GROUP_NAME" value="grid"/>
<property name="GROUP_PASSWORD" value="grid"/>
</bean>
<bean id="ClientInstance"
class="com.hazelcast.client.HazelcastClient" factory-
method="newHazelcastInstance">
<constructor-arg ref="ClientInstanceProperties" />
<constructor-arg>
<list>
<value>
127.0.0.1:5701</value>
</list>
</constructor-arg>
</bean>
Still no luck, now I get exception that
java.lang.ClassNotFoundException:
com.hazelcast.client.ClientProperties
But i can see this class inside hazelcast-all-1.9.1.jar included in my
project, Classpath is also pointing to the location of the jar.
Can some one post a working example of spring / hazelcast server /
client instantiation ?
Thanks,
Roman