javaspring-bootinfinispan

Infinispan - Spring Boot 3.2.5 Integration javax.transaction error


I am developing a simple Spring Boot app that integrates with Infinispan. My pom is:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.tsdevelopment</groupId>
    <artifactId>spring-boot-cache</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-cache</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>5.5.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-spring-boot-starter-remote</artifactId>
            <version>14.0.32.Final</version>
        </dependency>

        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-client-hotrod</artifactId>
            <version>14.0.32.Final</version>
        </dependency>

        <dependency>
            <groupId>jakarta.transaction</groupId>
            <artifactId>jakarta.transaction-api</artifactId>
            <version>2.0.1</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

The following config in application.properties

infinispan.remote.server-list=127.0.0.1:11222
infinispan.remote.auth-username=admin
infinispan.remote.auth-password=admin

And this config class:

import org.infinispan.spring.remote.provider.SpringRemoteCacheManagerFactoryBean;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableCaching
public class CacheConfig {
    @Bean
    public SpringRemoteCacheManagerFactoryBean remoteCacheManagerFactoryBean() {
        return new SpringRemoteCacheManagerFactoryBean();
    }

    @Bean
    public CacheManager cacheManager(SpringRemoteCacheManagerFactoryBean remoteCacheManagerFactoryBean) throws Exception {
        return remoteCacheManagerFactoryBean.getObject();
    }
}

When i run the app i get:

Caused by: java.lang.NoClassDefFoundError: javax/transaction/RollbackException

My understanding is that SpringBoot moved from javax to jakarta transaction API, so i don't want to add a javax dependency to my POM. I am using the most recent version of Infinispan (14.0.32.Final). Is there a way around this? Or is it that Infinispan has not yet moved to jakarta?


Solution

  • Infinispan 14 has both JavaEE and Jakarta artifacts. Infinispan 15 is Jakarta only.