Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring context: lite-member.enabled attribute not parsed properly #6945

Closed
dsukhoroslov opened this issue Dec 1, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@dsukhoroslov
Copy link
Contributor

commented Dec 1, 2015

HZ: 3.6-EA2, Spring: 4.1.1.RELEASE

Just tried the new lite-member flag with Spring context. It still does not work.

spring context is:

<hz:hazelcast id="hzInstance">
    <hz:config>
        <hz:spring-aware/>
        <hz:instance-name>hzInstance</hz:instance-name>
        <hz:group name="system" password="system"/>
        <hz:properties>
            <hz:property name="hazelcast.logging.type">slf4j</hz:property>
        </hz:properties>
        <hz:network port="5701" port-auto-increment="true">
            <hz:join>
                <hz:multicast enabled="false"/>
                <hz:tcp-ip enabled="true" connection-timeout-seconds="10">
                    <hz:members>localhost</hz:members>
                </hz:tcp-ip>
            </hz:join>
        </hz:network>
        <hz:lite-member enabled="true"/>
    </hz:config>
</hz:hazelcast>

the class to load context is:

public class TestServer {

private static final transient Logger logger = LoggerFactory.getLogger(TestServer.class);
private static ApplicationContext context;

@SuppressWarnings("unchecked")
public static void main(String[] args) {

    String contextPath = "spring/test-context.xml";
    logger.info("Starting HZ node with Context [{}]", contextPath);

    context = new ClassPathXmlApplicationContext(contextPath);
    HazelcastInstance hz = context.getBean("hzInstance", HazelcastInstance.class);
    logger.debug("System Cache started with Config: {}", hz.getConfig());

}

}

The app can not start. Exception thrown is:

01:03:13.699 [main] WARN o.s.c.s.ClassPathXmlApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hzInstance': Cannot create inner bean '(inner bean)#63534f4f' of type [com.hazelcast.config.Config] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#63534f4f': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'liteMember'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:636) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:446) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1113) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1008) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:505) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) [spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) [spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at TestServer.main(TestServer.java:22) [classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#63534f4f': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'liteMember'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:548) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] ... 17 common frames omitted Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'liteMember'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:480) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1517) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1476) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1216) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] ... 19 common frames omitted Caused by: java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.propertyeditors.CustomBooleanEditor.setAsText(CustomBooleanEditor.java:122) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:450) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:423) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:195) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:460) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE] ... 25 common frames omitted 01:03:13.699 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@b095dcb: defining beans [hzInstance]; root of factory hierarchy Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hzInstance': Cannot create inner bean '(inner bean)#63534f4f' of type [com.hazelcast.config.Config] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#63534f4f': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'liteMember'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129) at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:636) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:446) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1113) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:505) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) at TestServer.main(TestServer.java:22) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#63534f4f': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'liteMember'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:548) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276) ... 17 more Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'liteMember'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:480) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1476) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1216) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ... 19 more Caused by: java.lang.IllegalArgumentException: Invalid boolean value [] at org.springframework.beans.propertyeditors.CustomBooleanEditor.setAsText(CustomBooleanEditor.java:122) at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:450) at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:423) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:195) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:460) ... 25 more
@dsukhoroslov

This comment has been minimized.

Copy link
Contributor Author

commented Dec 2, 2015

please make sure it does work with Spring property placehoders too

@mustafaiman

This comment has been minimized.

Copy link
Member

commented Dec 4, 2015

@dsukhoroslov please see #6961 (comment) regarding Spring property placeholders

@dsukhoroslov

This comment has been minimized.

Copy link
Contributor Author

commented Dec 4, 2015

great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.