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

ClassNotFoundException when using javers-persistence-sql and gson 2.9.0 #1188

Closed
bitfisher opened this issue Feb 25, 2022 · 3 comments · Fixed by #1189
Closed

ClassNotFoundException when using javers-persistence-sql and gson 2.9.0 #1188

bitfisher opened this issue Feb 25, 2022 · 3 comments · Fixed by #1189

Comments

@bitfisher
Copy link
Contributor

Clear description of my expectations versus reality
I'm using javers with javers-persistence-sql and expected that updating gson from 2.8.9 to 2.9.0 wouldn't do any harm.
But using gson 2.9.0 will result in

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/internal/LinkedHashTreeMap
	at org.javers.repository.sql.schema.FixedSchemaFactory.allTablesSchema(FixedSchemaFactory.java:54)
	at org.javers.repository.sql.schema.JaversSchemaManager.ensureSchema(JaversSchemaManager.java:46)
	at org.javers.repository.sql.JaversSqlRepository.ensureSchema(JaversSqlRepository.java:186)
	at org.javers.core.JaversBuilder.build(JaversBuilder.java:133)
Caused by: java.lang.ClassNotFoundException: com.google.gson.internal.LinkedHashTreeMap
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	... 10 more

...

Steps To Reproduce
Update gson to 2.9.0 and call JaversBuilder.build

Javers' Version
6.6.2

Additional context
As stated in in https://github.com/google/gson/releases/tag/gson-parent-2.9.0 LinkedHashTreeMap is removed from gson but is used in javers-persistence-sql here https://github.com/javers/javers/blob/javers-6.6.2/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/FixedSchemaFactory.java
...

@bartoszwalacik
Copy link
Member

okay, looks like the Gson version used by Javers should be bumped, you can contribute a PR with the fix, see https://github.com/javers/javers/blob/master/gradle.properties

@bartoszwalacik
Copy link
Member

you did it already :) I will merge

@bartoszwalacik
Copy link
Member

fixed in 6.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants