I have a Spring boot: 2.3.0.RELEASE application with Flyway: 6.4.1 and Hibernate: hibernate-core: 5.4.22.Final, hibernate-validator: 6.1.5.Final, hibernate-commons-annotations: 5.1.0.Final.
I tried searching for errors but cannot find a solution. I tried applying this answer, but whenever spring.jpa.hibernate.ddl-auto=validate is set, it doesn't work if I use none
, drop-create
value everything back to the norm.
I run MySQL 5.7 in Docker, and the database with tables is there.
The error is below:
ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Unsatisfied dependency expressed through method 'requestMappingHandlerAdapter' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepository' defined in org.cloudwheel.files.configuration.customer.persistence.CustomerRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [my_files]
How can I debug this? I see many such issues, but none of the solutions worked for me.
NOTE: The table my_files
is present. I can verify this both via IntelliJ and MySQL Workbench. Also, I don't want to downgrade if possible.
UPDATE:
I am sure that a database isn't a problem:
2020-12-01 14:24:04.795 INFO 23295 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2020-12-01 14:24:04.800 INFO 23295 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-12-01 14:24:04.800 INFO 23295 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.35] 2020-12-01 14:24:04.895 INFO 23295 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2020-12-01 14:24:04.895 INFO 23295 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1762 ms 2020-12-01 14:24:07.982 INFO 23295 --- [ restartedMain] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 6.4.1 by Redgate 2020-12-01 14:24:07.986 INFO 23295 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource
: HikariPool-1 - Starting... 2020-12-01 14:24:08.090 INFO 23295 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1
- Start completed. 2020-12-01 14:24:08.113 INFO 23295 --- [ restartedMain] o.f.c.internal.database.DatabaseFactory : Database: jdbc:mysql://localhost:3307/files (MySQL 5.7) 2020-12-01 14:24:08.186 INFO 23295 --- [ restartedMain] o.f.core.internal.command.DbValidate : Successfully validated 13 migrations (execution time 00:00.029s) 2020-12-01 14:24:08.199 INFO 23295 --- [ restartedMain] o.f.core.internal.command.DbMigrate : Current version of schema
files
: 1.13 2020-12-01 14:24:08.200 INFO 23295 --- [ restartedMain] o.f.core.internal.command.DbMigrate : Schemafiles
is up to date. No migration necessary. 2020-12-01 14:24:08.268 INFO 23295 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-12-01 14:24:08.281 INFO 23295 --- [ restartedMain] o.s.s.c.ThreadPoolTaskScheduler
: Initializing ExecutorService 'taskScheduler' 2020-12-01 14:24:08.330 INFO 23295 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2020-12-01 14:24:08.374 INFO 23295 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.22.Final
validate
will work then? – Dmytro Chasovskyi