Spring BeanCreationException thrown when using hz:client

155 views
Skip to first unread message

Mario Zagar

unread,
Nov 11, 2011, 3:03:35 PM11/11/11
to Hazelcast
Hi,

I'm trying to use hz:client (hazelcast 1.9.4.4) with spring 3.1.0RC1,
but
am getting BeanCreationException when creating spring application
context.

My beans file and console output follow.

Am I doing something wrong here?
Please advise.

Thanks!
Regards,
Mario


== Beans file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/config"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-spring.xsd">

<hz:client id="hzClient" group-name="x" group-password="x">
<hz:members>127.0.0.1</hz:members>
</hz:client>

</beans>


== Console output:

[2011-11-11 20:56:34,749] INFO [main]
o.s.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean
definitions from class path resource [client.xml]
[2011-11-11 20:56:34,891] INFO [main]
o.s.context.support.GenericXmlApplicationContext - Refreshing
org.springframework.context.support.GenericXmlApplicationContext@5464ea66:
startup date [Fri Nov 11 20:56:34 CET 2011]; root of context hierarchy
[2011-11-11 20:56:34,934] INFO [main]
o.s.b.factory.support.DefaultListableBeanFactory - Pre-instantiating
singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@291946c2:
defining beans [client-properties,hhhh]; root of factory hierarchy
[2011-11-11 20:56:35,020] INFO [main]
o.s.b.factory.support.DefaultListableBeanFactory - Destroying
singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@291946c2:
defining beans [client-properties,hhhh]; root of factory hierarchy
Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'client-properties': Initialization of bean
failed; nested exception is
org.springframework.beans.ConversionNotSupportedException: Failed to
convert property value of type 'java.util.LinkedHashMap' to required
type 'java.util.Map' for property 'properties'; nested exception is
java.lang.IllegalStateException: Cannot convert value of type
[java.lang.String] to required type
[com.hazelcast.client.ClientProperties$ClientPropertyName] for
property 'properties[hazelcast.client.group.name]': no matching
editors or conversion strategy found
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:
530)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:
459)
at org.springframework.beans.factory.support.AbstractBeanFactory
$1.getObject(AbstractBeanFactory.java:294)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:
225)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:
291)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
193)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:
585)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:
913)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:
464)
at
org.infobip.spring.hzinvoker.client.ClientMain.main(ClientMain.java:
20)
Caused by: org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type 'java.util.LinkedHashMap' to
required type 'java.util.Map' for property 'properties'; nested
exception is java.lang.IllegalStateException: Cannot convert value of
type [java.lang.String] to required type
[com.hazelcast.client.ClientProperties$ClientPropertyName] for
property 'properties[hazelcast.client.group.name]': no matching
editors or conversion strategy found
at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:
485)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:
517)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:
510)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:
1396)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:
1355)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:
1111)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:
520)
... 9 more
Caused by: java.lang.IllegalStateException: Cannot convert value of
type [java.lang.String] to required type
[com.hazelcast.client.ClientProperties$ClientPropertyName] for
property 'properties[hazelcast.client.group.name]': no matching
editors or conversion strategy found
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:
234)
at
org.springframework.beans.TypeConverterDelegate.convertToTypedMap(TypeConverterDelegate.java:
610)
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:
180)
at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:
470)
... 15 more

Mehmet Dogan

unread,
Nov 18, 2011, 6:28:28 AM11/18/11
to haze...@googlegroups.com
Hi,

No you are not doing something wrong. It seems because some internal processing of bean creation of Spring has changed by v3.1.
It works with Spring versions before 3.1 (2.5.x or 3.0.x). Please create an issue regarding this problem to keep track of fix.

@mmdogan





--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.


Reply all
Reply to author
Forward
0 new messages