2 Replies Latest reply on Mar 8, 2016 1:44 AM by Krupa Likhite

    Using infinispan-embedded-jar and infinispan-commons jar together

    Krupa Likhite Newbie



      We are using infinispan cache for our application. We want to bundle infinispan jars inside application WAR. When we bundle jars of infinispan 7.2.5 minimal alone for using the cache in embedded mode, it works fine.

      When we bundle jars of hotrod java client alone inside our application WAR, application+caching works fine.

      We want to support both the modes of infinispan cache for our application. Based on a configuration parameter in application , either the embedded mode or hotrod client mode will be enabled. (Our application is client in case of hotrod. Hotrod cache ie server will be in some other machine).

      When 7.2.5 version's embedded and hotrod client jars from infinispan server suite are placed together inside our WAR, there is a conflict and EAR does not start giving below error.


      Caused by: java.lang.IllegalArgumentException: Logger implementation class org.infinispan.cdi.util.logging.Log_$logger has no matching constructor

        at org.jboss.logging.Logger$1.run(Logger.java:2260)

        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_25]

        at org.jboss.logging.Logger.getMessageLogger(Logger.java:2227)

        at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)

        at org.infinispan.commons.logging.LogFactory.getLog(LogFactory.java:19)

        at org.infinispan.cdi.InfinispanExtension.<clinit>(InfinispanExtension.java:26)


      Here, org.infinispan.cdi.InfinispanExtension is inside infinispan-embedded-2.5-final.jar.

      org.infinispan.commons.logging.LogFactory is inside infinispan-embedded-2.5-final.jar which is part of inifinispan embedded suite. There is another implementation of infinispan-embedded-2.5-final.jar which is inside infinispan-commons.jar/infinispan-commons-2.5-final.jar, this is part of hotrod client jars.

      When both the jars are inside WAR, at org.infinispan.commons.logging.LogFactory from infinispan-commons jar is getting picked up instead of getting referred from infinispan embedded jar resulting in error. What should be done to resolve this.