Search code examples
javaspringmavenactivejdbc

Spring application fails to start with ActiveJDBC instrumented classes


I am using Java 8, ActiveJDBC 1.4.13 and Spring Boot 2.0.0.RC1 with Spring 5.

On application startup I am getting this error:

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: FooActiveModel.class;

This problem appeared when I upgraded from Spring Boot 2.0.0.M7 to 2.0.0.RC1.

I have found a few references to this error but no mention of ActiveJDBC. In my case classes extended from the activejdbc.Model class (instrumented classes) are causing the problem.

As per answers and suggestions in these...

I have...

  • made sure I'm using Java 8
  • searched for conflicting dependencies
  • cleaned and rebuilt my project
  • deleted local maven repo that "might" have been corrupted
  • re-imported all the dependencies
  • upgraded all dependencies to their latest version

These options did not help.


Solution

  • Finally managed to solve this problem by excluding the problematic classes(the ones extended from activejdbc.Model that were being instrumented) from the spring component scan.

    To make sure that this was actually the reason for the error, I even reverted to my original pom.xml with all my previous dependency versions, re-imported everything, cleaned, rebuilt and sure enough I'm no longer having this issue.

    This was an extremely frustrating and time consuming problem, hope it helps somebody.