giosefer
giosefer

Reputation: 84

Integration RedHat DataGrid with Spring Boot (throw SocketTimeoutException)

I create an application with spring boot that use the data grid redHat (Infinispan 'Estrella Galicia' 9.3.6.Final in standalone) to management of java bean in memory chache.

When i get the cache configured on datagrid, i show the following error:

*java.net.SocketTimeoutException: FaultTolerantPingOperation{default, flags=0} timed out after 60000 ms at org.infinispan.client.hotrod.impl.operations.HotRodOperation.run(HotRodOperation.java:172) ~[infinispan-client-hotrod-9.4.0.Final.jar:9.4.0.Final]"

The configuration of my application is the following:

Console RedHat Datagrid:

enter image description here

enter image description here

Maven dependencies:

enter image description here

Configuration Spring:

@Primary
@Bean(name = "cacheManager")
public CacheManager cacheManager() throws Exception {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    builder.addServer().host("127.0.0.1").port(11222);  
    RemoteCacheManager remoteCacheManager = new RemoteCacheManager(builder.build());
    return new SpringRemoteCacheManager(remoteCacheManager);
}

@Bean
public CacheResolver cacheResolver() throws Exception {
    NamedCacheResolver resolver = new NamedCacheResolver();
    resolver.setCacheManager(cacheManager());
    resolver.setCacheNames(Collections.singleton("default"));
    return resolver;
}

This is the Java Bean

public class UdmOutput {
    private String entityCode;
    private Udm unitaPrimaria;
    private List<Udm> udmList;

    public UdmOutput() {
    }

    public String getEntityCode() {
        return entityCode;
    }

    public void setEntityCode(String entityCode) {
        this.entityCode = entityCode;
    }

    public List<Udm> getUdmList() {
        return udmList;
    }

    public void setUdmList(List<Udm> udmList) {
        this.udmList = udmList;
    }

    public Udm getUnitaPrimaria() {
        return unitaPrimaria;
    }

    public void setUnitaPrimaria(Udm unitaPrimaria) {
        this.unitaPrimaria = unitaPrimaria;
    }
}

This is the code used to insert java bean in cache:

@CachePut(cacheResolver="cacheResolver", key="#keyLogic")
public UdmOutput saveObjectInCache(UdmOutput msg, String keyLogic) {
    return msg;
}

When run of the method ends i get the exception SocketTimeoutException

Can you help me ?

Thanks a lot, Giuseppe.

Upvotes: 0

Views: 740

Answers (0)

Related Questions