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

hazelcast-spring.xsd : partition-group.enabled attribute type should be string #6927

mikeleo opened this issue Nov 30, 2015 · 2 comments


None yet
4 participants
Copy link

commented Nov 30, 2015

Using hazelcast 3.5.x, I am trying to externalize the enablement of partition-group to properties file, using Spring environment property replacement to enable based on the environment.

However, the "enabled" attribute for partition-group is set to type, boolean. Other "enabled" attributes are set to string. Having it set to boolean causes the initial loading and parsing of the XML to fail when the attribute contains property replacement value, instead of true/false.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
    xmlns:xsi="" xmlns:hz=""

    <hz:hazelcast id="instance">

            <hz:group password="$env{}" name="$env{}" />

            <hz:network port="5701" port-auto-increment="true">
                    <hz:multicast enabled="false" />

                    <hz:tcp-ip enabled="$env{hazelcast.tcpip.enabled}">

                    <hz:aws enabled="$env{}" access-key="$env{}"
                        secret-key="$env{}" security-group-name="$env{}"
                        host-header="" region="us-east-1" />


            <hz:partition-group enabled="$env{hazelcast.partition.enabled}" group-type="CUSTOM">

2015-11-30 10:17:18,104 ERROR main ContextLoader - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:spring-hazelcast-config.xml]
Offending resource: class path resource [spring-global-context.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 37 in XML document from class path resource [spring-hazelcast-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 37; columnNumber: 88; cvc-datatype-valid.1.2.1: '$env{hazelcast.partition.enabled}' is not a valid value for 'boolean'.

Changing the xs:boolean to xs:string in the XSD allows this to work and keeps it consistent with all other enabled attribute types.

    <xs:complexType name="partition-group">
            <xs:element name="member-group" minOccurs="0" maxOccurs="unbounded">
                        <xs:element name="interface" type="interface" minOccurs="0" maxOccurs="unbounded"/>
        <!-- <xs:attribute name="enabled" type="xs:boolean" use="required"/> -->
        <xs:attribute name="enabled" type="xs:string" use="required"/>
        <xs:attribute name="group-type" type="xs:string" use="optional"/>

If value other than true or false is used, the failure is still caught during the spring bean instantiation process with a TypeMismatchException/IllegalArgumentException

exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'enabled'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [fail]


This comment has been minimized.

Copy link

commented Dec 1, 2015

@jerrinot , please have a look at #6567. It is very similair issue. Could it be done in 3.6 as well?


This comment has been minimized.

Copy link

commented Dec 1, 2015

Hi @mikeleo ,

Spring environment property replacement was already added into 3.6 for partition-group.
Can you please try 3.6-EA2?

Unfortunately, we don't backport new feature additions to maintenance branches so it is normal that this is not available in 3.5.x

@mesutcelik mesutcelik closed this Dec 2, 2015

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.