derjust / spring-data-dynamodb

This module deals with enhanced support for a data access layer built on AWS DynamoDB.
https://derjust.github.io/spring-data-dynamodb/
Apache License 2.0
403 stars 141 forks source link

Spring boot starter parent 2.2.0.RELEASE breaking change -- server doesn't start #267

Open raythien opened 5 years ago

raythien commented 5 years ago

This problem is caused because the deprecated class org.springframework.data.repository.core.support.ReflectionEntityInformation<T, ID> was removed in favor of org.springframework.data.repository.core.support.PersistentEntityInformation<T, ID>.

Expected Behavior

Spring server (Tomcat)/application loads normally.

Actual Behavior

Dynamo DB shows the following warning: WARN 25900 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : This Spring Data DynamoDB implementation might not be compatible with the available Spring Data classes on the classpath!

Then, the following exception is thrown: Caused by: java.lang.NoClassDefFoundError: org/springframework/data/repository/core/support/ReflectionEntityInformation at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) ~[na:na] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na] at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBEntityMetadataSupport.getEntityInformation(DynamoDBEntityMetadataSupport.java:125) ~[spring-data-dynamodb-5.1.0.jar:5.1.0] at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.getEntityInformation(DynamoDBRepositoryFactory.java:104) ~[spring-data-dynamodb-5.1.0.jar:5.1.0] at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.getDynamoDBRepository(DynamoDBRepositoryFactory.java:128) ~[spring-data-dynamodb-5.1.0.jar:5.1.0] at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.getTargetRepository(DynamoDBRepositoryFactory.java:150) ~[spring-data-dynamodb-5.1.0.jar:5.1.0] at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:312) ~[spring-data-commons-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297) ~[spring-data-commons-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.data.util.Lazy.getNullable(Lazy.java:212) ~[spring-data-commons-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.data.util.Lazy.get(Lazy.java:94) ~[spring-data-commons-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300) ~[spring-data-commons-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1862) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE] ... 188 common frames omitted

Steps to Reproduce the Problem

  1. Upgrade spring boot to version 2.2.0
  2. Start the server/application

Specifications

All those information are logged by org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory on INFO level on startup. Or use java -version and mvn dependency:tree | grep -E 'spring|aws' to provide those version numbers.

dragneelfps commented 5 years ago

I am getting the same error on Spring boot 2.2.0.Release.

boostchicken commented 5 years ago

https://github.com/derjust/spring-data-dynamodb/pull/270

Feel free to check out from my repo and build locally. If there is a need I can start taking over maintenance from @derjust since he has been very inactive.

boostchicken commented 5 years ago

@raythien @dragneelfps

Published to OSSRH Snapshots give it a go and let me know how it works.

repositories {
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
`api  group: 'io.github.boostchicken', name: 'spring-data-dynamodb', version: '5.2.0-SNAPSHOT'`
timomeinen commented 5 years ago

@boostchicken Thank you. Works for me.

boostchicken commented 5 years ago
api  group: 'io.github.boostchicken', name: 'spring-data-dynamodb', version: '5.2.1'

Release and on central.

raythien commented 5 years ago

Thanks @boostchicken!

tobiashochguertel commented 4 years ago

Has development stopped here? or does @derjust do you search for new maintainers? I think this isn't a good way when we don't work together and everyone forks, to fix a bug and no pull request goes back into the origin?

boostchicken commented 4 years ago

@tobiashochguertel I don't want to fork, I sent a PR. Up to @derjust to do something with it.

tobiashochguertel commented 4 years ago

I understand, I had in the past same issues with an open source project on my github channel, I was a long time ill and now I'm back and was able to care about pull request in my project. šŸ¤” We have to wait for @derjust . He did a nice project šŸ‘.

edwin-mendoza commented 4 years ago

Hi - where are we with this? i am having the same issue :( are we still waiting for @derjust?

sathorius commented 4 years ago

I have problem with same config Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)


APPLICATION FAILED TO START


Description:

Parameter 0 of constructor in com.techcentrix.user.config.dbmigrations.InitialSetup required a bean of type 'com.techcentrix.user.repository.UserRepository' that could not be found.

timomeinen commented 4 years ago

@sathorius You don't have a bean of type UserRepository in your application context. It has nothing to do with spring-data-dynamodb.

jacace commented 4 years ago

I just spent a couple of days troubleshooting this. It's a shame that the fix PR has not been accepted and that the issue is still open since October 2019 :(

cb-manideep commented 4 years ago

+1

caballeto commented 4 years ago

Damn, I spent 3 days on it. Please mark the issue as resolved!

boostchicken commented 4 years ago

Use my fork. It is fixed.

bsivalingampax8 commented 3 years ago

For this version implementation 'io.github.boostchicken:spring-data-dynamodb:5.2.5' , which version of spring boot I should use. I am using spring boot version 2.4.3, getting ClassNotFoundException