Home > other >  Apache Ignite Spring Data Extension Dependency Error
Apache Ignite Spring Data Extension Dependency Error

Time:09-07

I am new to Apache Ignite and learning how to use the Ignite Spring Data Extension and am having a dependency compatibility problem.

Dependency used:

  1. Spring Data commons 2.7.2 (org.springframework.data:spring-data-commons:2.7.2)
  2. ignite-core 2.13.0 (org.apache.ignite:ignite-core:2.13.0)
  3. ignite-spring 2.13.0 (org.apache.ignite:ignite-spring:2.13.0)
  4. ignite-spring-boot-thin-client-autoconfigure-ext 2.13.0 (org.apache.ignite:ignite-spring-boot-thin-client-autoconfigure-ext:2.13.0)
  5. ignite-indexing 2.13.0 (org.apache.ignite:ignite-indexing:2.13.0)
  6. ignite-spring-data-2.2-ext 1.0.0 (org.apache.ignite:ignite-spring-data-2.2-ext:1.0.0) OR ignite-spring-data-ext 2.0.0 (org.apache.ignite:ignite-spring-data-ext:2.0.0)

Course of action:

According to the documentation, I should pick a version of Spring Data Commons, Ignite dependencies and the Ignite Spring Data Extension. So I picked the latest for everything (as shown above). Then the documentation said I should use ignite-spring-data-2.2-ext as I am using Spring Data 2.7.2 (>= 2.2). So I tried and ran into the following maven build error:

java: name clash: deleteAllById(java.lang.Iterable) in org.apache.ignite.springdata22.repository.IgniteRepository and deleteAllById(java.lang.Iterable<? extends ID>) in org.springframework.data.repository.CrudRepository have the same erasure, yet neither overrides the other*

Googling led me to this post and the public maven repository, it seems a new version that fixes the method signature had been out; so I switched ignite-spring-data-ext 2.0.0. But then I ran into another app startup ClassNotFoundException (Spring Dependency):

java.lang.NoClassDefFoundError: org/springframework/dao/InvalidDataAccessApiUsageException
    at org.apache.ignite.springdata.repository.config.IgniteRepositoriesRegistar.getExtension(IgniteRepositoriesRegistar.java:34) ~[ignite-spring-data-ext-2.0.0.jar:2.0.0]
    at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:100) ~[spring-data-commons-2.7.2.jar:2.7.2]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:396) ~[spring-context-5.3.22.jar:5.3.22]
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_161]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:395) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:157) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.22.jar:5.3.22]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) [spring-boot-2.7.3.jar:2.7.3]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) [spring-boot-2.7.3.jar:2.7.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) [spring-boot-2.7.3.jar:2.7.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) [spring-boot-2.7.3.jar:2.7.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) [spring-boot-2.7.3.jar:2.7.3]
    at com.example.ignitespringdatalocal.IgniteSpringDataLocalApplication.main(IgniteSpringDataLocalApplication.java:21) [classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.dao.InvalidDataAccessApiUsageException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_161]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_161]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[na:1.8.0_161]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_161]
    ... 19 common frames omitted*

So I wonder:

  1. What maven dependency am I missing?
  2. Is there any table that shows which version of Ignite Spring Data Extension supports which version of Spring Data?
  3. Ignite team, please kindly update this part of the documentation as I feel a bit lost over my troubleshooting, thanks!

In the meantime, I will keep googling which dependency am I missing.

CodePudding user response:

It looks like the "org.springframework:spring-tx" dependency is missing:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>${spring.version}</version>
</dependency>

For some reason, it is only listed on the Spring Transactions page in the documentation, which doesn't look right. I've filed documentation ticket for that.

  • Related