0

Absolute Hazelcast newbie here. Inspired by this, I have created a bare minimum Spring Boot application and I'm trying to replicate the session using Hazelcast. I have added this to my pom.xml file:

        <dependency>
            <groupId>com.hazelcast</groupId>
            <artifactId>hazelcast-all</artifactId>
            <version>3.12.5</version>
        </dependency> 

And created this config file:

@Configuration
public class HazelcastConfiguration {

    @Bean
    public Config config() {

        Config config = new Config();

        JoinConfig joinConfig = config.getNetworkConfig().getJoin();

        joinConfig.getMulticastConfig().setEnabled(false);
        joinConfig.getTcpIpConfig().setEnabled(true).setMembers(singletonList("127.0.0.1"));

        return config;
    }

    @Bean
    public WebFilter webFilter(HazelcastInstance hazelcastInstance) {

        Properties properties = new Properties();
        properties.put("instance-name", hazelcastInstance.getName());
        properties.put("sticky-session", "false");

        return new WebFilter(properties);
    }
}

When I start one (or more) instances of the application I get this on the console:

2020-01-23 17:49:02.318  INFO 24304 --- [cached.thread-2] com.hazelcast.nio.tcp.TcpIpConnector     : [127.0.0.1]:5701 [dev] [3.12.5] Connecting to /127.0.0.1:5702, timeout: 10000, bind-any: true
2020-01-23 17:49:02.323  WARN 24304 --- [.IO.thread-in-1] com.hazelcast.nio.tcp.TcpIpConnection    : [127.0.0.1]:5701 [dev] [3.12.5] Connection[id=10, /127.0.0.1:59818->/127.0.0.1:5702, qualifier=null, endpoint=[127.0.0.1]:5702, alive=false, type=NONE] closed. Reason: Exception in Connection[id=10, /127.0.0.1:59818->/127.0.0.1:5702, qualifier=null, endpoint=[127.0.0.1]:5702, alive=true, type=NONE], thread=hz._hzInstance_1_dev.IO.thread-in-1

java.io.IOException: An existing connection was forcibly closed by the remote host
    at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[na:1.8.0_192]
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) ~[na:1.8.0_192]
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[na:1.8.0_192]
    at sun.nio.ch.IOUtil.read(IOUtil.java:197) ~[na:1.8.0_192]
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) ~[na:1.8.0_192]
    at com.hazelcast.internal.networking.nio.NioInboundPipeline.process(NioInboundPipeline.java:113) ~[hazelcast-all-3.12.5.jar:3.12.5]
    at com.hazelcast.internal.networking.nio.NioThread.processSelectionKey(NioThread.java:369) [hazelcast-all-3.12.5.jar:3.12.5]
    at com.hazelcast.internal.networking.nio.NioThread.processSelectionKeys(NioThread.java:354) [hazelcast-all-3.12.5.jar:3.12.5]
    at com.hazelcast.internal.networking.nio.NioThread.selectLoop(NioThread.java:280) [hazelcast-all-3.12.5.jar:3.12.5]
    at com.hazelcast.internal.networking.nio.NioThread.run(NioThread.java:235) [hazelcast-all-3.12.5.jar:3.12.5]

What am I doing wrong?

Vahid
  • 190
  • 3
  • 9
  • 2
    Your Hazelcast Config worked fine for me with Spring Boot v2.2.1.RELEASE. This feels like a networking issue on your machine. – Mesut Jan 23 '20 at 19:29
  • Mesut, it very well could be. thanks for your response. – Vahid Jan 24 '20 at 09:25

0 Answers0