Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove note about Infinispan's Spring Boot Starter as it is not yet 3.0-compatible #32896

Closed
vpavic opened this issue Oct 26, 2022 · 3 comments
Closed
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@vpavic
Copy link
Contributor

vpavic commented Oct 26, 2022

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 26, 2022
@wilkinsona
Copy link
Member

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.

@wilkinsona wilkinsona changed the title Managed version of Infinispan is not fully compatible with Spring Boot 3.0 Remove note about Infinispan's Spring Boot Starter as it is not yet 3.0-compatible Oct 27, 2022
@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 27, 2022
@wilkinsona wilkinsona added this to the 3.0.x milestone Oct 27, 2022
@vpavic
Copy link
Contributor Author

vpavic commented Oct 27, 2022

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.

@mhalbritter mhalbritter self-assigned this Oct 27, 2022
@mhalbritter mhalbritter modified the milestones: 3.0.x, 3.0.0-RC2 Oct 27, 2022
@vpavic
Copy link
Contributor Author

vpavic commented Oct 30, 2022

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

4 participants