Infinispan was upgraded to 14.0.1.Final in #32798.
Unfortunately, this version of Infinispan does not appear to be fully compatible with Spring Boot 3.0. I ran into issues while upgrading a project of mine with various Spring Session samples.
The problem can be reproduced using sample-httpsession-infinispan subproject from vpavic/samples-spring-session/tree/infinispan. Running ./gradlew :sample-httpsession-infinispan:check results in a test failure with root cause of:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.infinispan.manager.DefaultCacheManager]: Factory method 'defaultCacheManager' threw exception with message: javax/transaction/TransactionManager
at app//org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
at app//org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
... 153 more
Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
at org.infinispan.configuration.cache.TransactionConfiguration.<clinit>(TransactionConfiguration.java:31)
at org.infinispan.configuration.cache.TransactionConfigurationBuilder.<init>(TransactionConfigurationBuilder.java:43)
at org.infinispan.configuration.cache.ConfigurationBuilder.<init>(ConfigurationBuilder.java:53)
at org.infinispan.spring.starter.embedded.InfinispanEmbeddedAutoConfiguration.defaultCacheManager(InfinispanEmbeddedAutoConfiguration.java:92)
at org.infinispan.spring.starter.embedded.InfinispanEmbeddedAutoConfiguration$$SpringCGLIB$$0.CGLIB$defaultCacheManager$0(<generated>)
at org.infinispan.spring.starter.embedded.InfinispanEmbeddedAutoConfiguration$$SpringCGLIB$$2.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:257)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at org.infinispan.spring.starter.embedded.InfinispanEmbeddedAutoConfiguration$$SpringCGLIB$$0.defaultCacheManager(<generated>)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
... 154 more
Caused by: java.lang.ClassNotFoundException: javax.transaction.TransactionManager
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 168 more
This happens because org.infinispan.commons.tx.lookup.TransactionManagerLookup depends on javax.transaction.TransactionManager rather then the Jakarta equivalent.
Also note that in order for @EnableInfinispanEmbeddedHttpSession to work at all, I had to provide META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports myself and list involved auto-configuration classes, since org.infinispan:infinispan-spring-boot-starter-embedded still uses META-INF/spring.factories.
So in summary, there are (at least) following issues with managed version of Infinispan:
- incompatibility with Spring Framework 6.0 due to dependency on javax namespace in components involved in support for Spring caching abstraction
- incompatibility with Spring Boot 3.0 due to lack of META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports in modules that provide auto-configuration support
At its core these are all Infinispan issues, but at the same time the outcome is that Spring Boot is basically managing dependencies that are not compatible.
Comment From: wilkinsona
To avoid the javax.transaction problem you need to use the -jakarta variant of various Infinispan modules. Their starter doesn't do that yet as it hasn't been updated for Spring Boot 3.0. Given that, we should update the docs to remove the mention of their starter.
In summary, if you stick to Spring Boot's built-in Inifinispan support things should work. If you want to use Infinispan's Spring Boot support, you'll have to wait for it to be updated for Spring Boot 3.0. That's obviously not perfect but it's the best that we can do right now and I think it's better than having no Infinispan support at all for 3.0.
Comment From: vpavic
I missed that there are -jakarta variants of Infinispan modules, thanks for the suggestion.
I don't use Infinispan outside of these Spring Session samples, so I'm not really impacted by this, but it seemed like something that should be addressed in one way or another. The suggested documentation changes sound like a good compromise.
Comment From: vpavic
After reviewing the current state of the documentation related to this, I think that instead of just removing the note completely, it might be a good idea to replace it with another note mentioning that Infinispan's Spring modules (that are still mentioned in Appendix F: Dependency Versions) don't have first-class support for Spring 6 and Spring Boot 3 yet and should be used with extra care (dependency replacements and potentially other workarounds).