Hazelcast & Spring

388 views
Skip to first unread message

ro...@usamp.com

unread,
Jan 24, 2011, 11:13:30 PM1/24/11
to Hazelcast
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

Vladimir Dolzhenko

unread,
Jan 25, 2011, 1:26:28 AM1/25/11
to Hazelcast

Roman Prigozhin

unread,
Jan 25, 2011, 12:00:46 PM1/25/11
to Hazelcast
Thanks for the reference, I've seen this. But xmlns:hz="http://
www.hazelcast.com/schema/config" reference can not be resolved, looks
like it's a broken link so xml validation fails.

Vladimir Dolzhenko

unread,
Jan 25, 2011, 1:50:25 PM1/25/11
to Hazelcast
these xsds are in hazelcast-spring.jar file and there is scheme file
for spring support within that's jars - so everything should works
properly.

On 25 янв, 20:00, Roman Prigozhin <ro...@aadt.com> wrote:
> Thanks for the reference, I've seen this. But xmlns:hz="http://www.hazelcast.com/schema/config" reference can not be resolved, looks

ro...@usamp.com

unread,
Jan 25, 2011, 8:48:45 PM1/25/11
to Hazelcast
For whatever reason spring doesn't want to resolve xsd located in the
jar file, do you have any suggestions ?

On Jan 25, 10:50 am, Vladimir Dolzhenko <vladimir.dolzhe...@gmail.com>
wrote:

dhagge

unread,
Feb 15, 2011, 6:14:11 PM2/15/11
to Hazelcast
I encountered the same thing but in my specific case the culprit was
eclipse. Seems to work fine when project is built and running outside
of eclipse.

I had to add a user specified catalog contribution to Eclipse so the
xml builder could resolve http://www.hazelcast.com/schema/config/hazelcast-spring.xsd.

http://stackoverflow.com/questions/901242/why-cant-eclipse-resolve-the-spring-dwr-schema

Vladimir Dolzhenko

unread,
Feb 15, 2011, 11:52:40 PM2/15/11
to Hazelcast
try to create eclipse specific project files using
mvn eclipse:eclipse

On 16 фев, 02:14, dhagge <damianha...@gmail.com> wrote:
> I encountered the same thing but in my specific case the culprit was
> eclipse.  Seems to work fine when project is built and running outside
> of eclipse.
>
> I had to add a user specified catalog contribution to Eclipse so the
> xml builder could resolvehttp://www.hazelcast.com/schema/config/hazelcast-spring.xsd.
>
> http://stackoverflow.com/questions/901242/why-cant-eclipse-resolve-th...
Reply all
Reply to author
Forward
0 new messages