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

java.lang.ClassCastException: class cannot be cast to class java.util.List #851

tim-ber opened this issue Jun 13, 2019 · 3 comments


Copy link

tim-ber commented Jun 13, 2019

Using javers-spring-boot-starter-sql 5.5.2, I'm getting the following error message for some types of commits. In the commit, a reference to another entity has been changed to null. Looks like wrapNull method is trying to cast an enum to a List, which throws java.lang.ClassCastException.

java.lang.ClassCastException: class cannot be cast to class java.util.List ( is in unnamed module of loader 'app'; java.util.List is in module java.base of loader 'bootstrap')
	at org.javers.common.collections.Lists.wrapNull(
	at org.javers.core.graph.LiveNode.getDehydratedPropertyValue(
	at org.javers.core.diff.NodePair.getRightDehydratedPropertyValueAndSanitize(
	at org.javers.core.diff.appenders.CorePropertyChangeAppender.calculateChanges(
	at org.javers.core.diff.DiffFactory.appendChanges(
	at org.javers.core.diff.DiffFactory.appendPropertyChanges(
	at org.javers.core.diff.DiffFactory.createAndAppendChanges(
	at org.javers.core.diff.DiffFactory.create(
	at org.javers.core.commit.CommitFactory.createCommit(
	at org.javers.core.commit.CommitFactory.create(
	at org.javers.core.JaversCore.commit(
	at org.javers.spring.jpa.JaversTransactionalDecorator.commit(
Copy link

bartoszwalacik commented Jun 13, 2019

Please push a failing test case, see how we write tests

Copy link

looks like I have it

    class Entity1 {
        @Id int id

    class Entity2 {
        @Id int id
        List<String> props

    def "should report when a list property is added or removed"(){
      def javers = javers().build()
      def object1 = new Entity1(id:1)
      def object2 = new Entity2(id:1, props: ["p"])

      def diff =, object2)
      println diff.prettyPrint()
      def changes = diff.getChangesByType(PropertyChange)

      changes.size() == 1

Copy link

Fixed in 5.6.0

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

No branches or pull requests

2 participants