2 Replies Latest reply on Jun 20, 2017 8:31 AM by sebastian.laskawiec

    Infinispan hot rod failover with Spring Cache

    dkirilov

      Hello,

       

      I'm using Infinispan as a implementation for Spring Cache and are having quite a (apparently simple) problem, which I cant find a solution on the internet.

       

      I have catched methods with the @Cacheable annotation and its working fine, but when the infinispan server goes offline or for some reason it cant be reached, an exception is launched and request isnt served:

       

      org.infinispan.client.hotrod.exceptions.TransportException: Could not fetch transport

        at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory.borrowTransportFromPool(TcpTransportFactory.java:418) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory.getTransport(TcpTransportFactory.java:250) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        at org.infinispan.client.hotrod.impl.operations.FaultTolerantPingOperation.getTransport(FaultTolerantPingOperation.java:28) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        at org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:55) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

      .....

        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]

      Caused by: org.infinispan.client.hotrod.exceptions.TransportException: Could not connect to server: /10.132.7.114:11222

        at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport.<init>(TcpTransport.java:85) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        at org.infinispan.client.hotrod.impl.transport.tcp.TransportObjectFactory.makeObject(TransportObjectFactory.java:38) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        at org.infinispan.client.hotrod.impl.transport.tcp.TransportObjectFactory.makeObject(TransportObjectFactory.java:17) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1220) ~[commons-pool-1.6.jar:1.6]

        at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory.borrowTransportFromPool(TcpTransportFactory.java:412) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        ... 90 common frames omitted

      Caused by: java.net.SocketTimeoutException: null

        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:118) ~[na:1.8.0_102]

        at org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport.<init>(TcpTransport.java:75) ~[infinispan-client-hotrod-9.0.0.Final.jar:9.0.0.Final]

        ... 94 common frames omitted

       

      The wanted behavior is that if the connection to Infinispan fails, the data should be retrieved from the original source (execute the annotated method) and not end the execution and throw an exception.

       

      How do I do that?

       

      Thanks a lot!