-1

Using javers-core 3.10.2 and javers-spring-boot-starter-sql 3.10.2 javers works well initially. But after restarting spring boot application getting following error.

JaversException TYPE_NAME_NOT_FOUND: type name 'Person' not found. If you are using @TypeName annotation, remember to register this class using JaversBuilder.withPackagesToScan(String) or JaversBuilder.scanTypeName(Class)] with root cause

L_J
  • 2,351
  • 10
  • 23
  • 28
razi
  • 41
  • 4

2 Answers2

0

The error message is saying what you have to do, use javers.packagesToScan property in your application.yml as described here https://javers.org/documentation/spring-boot-integration/#javers-configuration-properties

Bartek Walacik
  • 3,386
  • 1
  • 9
  • 14
  • setting javers.packagesToScan="mypackage" but still getting type-name-not found any idea how to fix it? or how to register package to scan with javers in spring boot ?? – razi Jul 29 '18 at 15:18
  • Try to find the reason of your issue, whats going on when `withPackagesToScan()` is executed? Is this method called? What's logged? See the source here, it's easy to understand and debug https://github.com/javers/javers/blob/d5ac085c94b5459d464a14ab3e489f31e3c7c110/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L284 – Bartek Walacik Jul 30 '18 at 18:11
0
  • By default javers store complete package path(com.app.model.Person) as model name for which we are storing audits trails.Which might change during code refactoring. So while fetching audits logs we get error TYPE_NAME_NOT_FOUND because of old path still persist in javers tables.
  • To avoid this we can use 2 strategies:

  • use @Typescan("Person") annotation with model class and set javers.packagesToScan=com.app.model,com.app.doc.model in spring properties file

  • Or run migration in all jv_* tables that will replace old path to new path

razi
  • 41
  • 4