Hazelcast java 11

1,043 views
Skip to first unread message

sachin...@gmail.com

unread,
Mar 16, 2019, 5:38:49 AM3/16/19
to Hazelcast
Hello,

Can someone please confirm what is the minimum Hazelcast version I need for a Java 11 Spring Boot App?  I am using Spring Boot 2.1.2.  

Also I have currently set in my maven pom.xml file to use hazelcast-all version 3.11. In my Spring Boot app I have the following property set

spring.hazelcast.config=file:///C:/ep_conf/ep-elm/hazelcast.xml

When I run my app I get the error:

Caused by: com.hazelcast.config.InvalidConfigurationException: Invalid root element in xml configuration! Expected: <hazelcast-client>, Actual: <hazelcast>.
at com.hazelcast.client.config.XmlClientConfigBuilder.checkRootElement(XmlClientConfigBuilder.java:214)
at com.hazelcast.client.config.XmlClientConfigBuilder.parseAndBuildConfig(XmlClientConfigBuilder.java:200)
at com.hazelcast.client.config.XmlClientConfigBuilder.build(XmlClientConfigBuilder.java:188)

Note this error does not appear when I set hazelcast-all to version 3.6.2. I have attached a copy of my hazelcast.xml file I am using.  Any idea what causes this?

Kind Regards,

Sachin Sharma
hazelcast.xml

Mesut Celik

unread,
Mar 16, 2019, 8:03:25 AM3/16/19
to haze...@googlegroups.com
Hazelcast does support Java 11. please see related issue.
https://github.com/hazelcast/hazelcast/issues/13182

For the issue that you are having, just keep hazelcast.xml in the classpath and do not use spring.hazelcast.config. Spring Boot will directly use hazelcast.xml to start hazelcast member.

If you are interested why this is happening, let me explain.
If you define spring.hazelcast.config and hazelcast-client is on the classpath(hazelcast-all includes hazelcast-client) then Spring Boot tries to create an Hazelcast Client instead of Hazelcast Member.
I feel like that is a bug in Spring Boot autodiscovery part because users normally define spring.hazelcast.config for hazelcast member configuration. 

You can see how initialization is done and how spring.hazelcast.config  for hazelcast client(second part) in the following link.


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/1f9894ae-cd81-428b-aad2-470ed8315608%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Mesut Celik
Services & Integration Team Lead 
me...@hazelcast.com 
hazelcast-logo-email.png

sachin...@gmail.com

unread,
Mar 18, 2019, 2:42:13 PM3/18/19
to Hazelcast
Thank you that worked when adding it to the classpath.  I would like if possible to put it in an external location as well. I tried doing this by specifying the command line argument in my pom.xml file:

-Dspring.config.location=${CONFIG.ROOT}/myapp/external.properties -Dhazelcast.config=${CONFIG.ROOT}/myApp/hazelcast.xml

However when I start my app I get the error:

Caused by: com.hazelcast.core.HazelcastException: com.hazelcast.core.HazelcastException: Config file at 'C:\GitProjects\myApp\file:\C:\ep_conf\ep-elm\hazelcast.xml' doesn't exist.
at com.hazelcast.config.XmlConfigLocator.<init>(XmlConfigLocator.java:68)
at com.hazelcast.config.XmlConfigBuilder.<init>(XmlConfigBuilder.java:179)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:128)
at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:91)
at org.springframework.boot.autoconfigure.hazelcast.HazelcastServerConfiguration$HazelcastServerConfigFileConfiguration.hazelcastInstance(HazelcastServerConfiguration.java:56)
at org.springframework.boot.autoconfigure.hazelcast.HazelcastServerConfiguration$HazelcastServerConfigFileConfiguration$$EnhancerBySpringCGLIB$$10e6a30e.CGLIB$hazelcastInstance$0(<generated>)
at org.springframework.boot.autoconfigure.hazelcast.HazelcastServerConfiguration$HazelcastServerConfigFileConfiguration$$EnhancerBySpringCGLIB$$10e6a30e$$FastClassBySpringCGLIB$$4bbf955d.invoke(<generated>)

It seems it has taken the path of where my project is located in and append the hazelcast.config system property passed by the command line therefore creating an invalid path.  Is there a way to resolve that?

Kind Regards,

Sachin Sharma

Mesut Celik

unread,
Mar 18, 2019, 7:36:21 PM3/18/19
to haze...@googlegroups.com
-Dhazelcast.config seems right approach and it should work. Your problem looks like specific to Windows related.
Did you try by passing full path and see if it works? like -Dhazelcast.config=file:///C:/ep_conf/ep-elm/hazelcast.xml
What is the value of ${CONFIG.ROOT}


For more options, visit https://groups.google.com/d/optout.
hazelcast-logo-email.png

sachin...@gmail.com

unread,
Mar 19, 2019, 6:33:46 AM3/19/19
to Hazelcast
I just tried by using -Dhazelcast.config=file:///C:/ep_conf/ep-elm/hazelcast.xml and I got the same error.  The value ${CONFIG.ROOT} is a value set in my maven settings.xml file and it is file:///C:/ep_conf/ .

I tried setting the exact path without the file:/// prefix using -Dhazelcast.config=C:/ep_conf/ep-elm/hazelcast.xml and this works.

It seems it does not like the file prefix so I could jsut pass the path without the prefix.

Kind Regards,

Sachin Sharma
Reply all
Reply to author
Forward
0 new messages