Flyway integration(Enterprise Version) in Spring Boot problem - spring-boot

Hello i got this error when i use flyway enterprise in my springboot project:
16:27:46 WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'springAsyncConfig': Unsatisfied dependency expressed through field 'customAsyncExceptionHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAsyncExceptionHandler': Unsatisfied dependency expressed through field 'importHistoryRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importHistoryRepository': Cannot create inner bean '(inner bean)#31db34da' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#31db34da': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration': Unexpected exception during bean creation; nested exception is java.lang.TypeNotPresentException: Type org.flywaydb.core.api.callback.FlywayCallback not present
Here is my pom.xml file:
<dependency>
<groupId>org.flywaydb.enterprise</groupId>
<artifactId>flyway-core</artifactId>
<version>6.0.3</version>
</dependency>

Related to this Issue Flyway 6.x.x is not compatible with Spring Boot < 2.2.0.
So you got 2 Choices:
Update Spring Boot to >= 2.2.0
Use flyway 5.x.x
Hope this helps

Related

Unable to use MicroMeter instead Of Prometheus

I upgraded my Spring Version from 1.5 to 2.0 and upgraded Prometheus version 0.3.0 to 0.6.0. But unfortunately, it was not working. I was told I have to use MicroMeter instead of SimpleClient and added io.micrometer to my pom.xml and #EnablePrometheusEndpointremoved for my MetricConfig class but I come across with following error. Do you know why I get such kind of error ?
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'servletEndpointRegistrar' defined in
class path resource
[org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]:
Factory method 'servletEndpointRegistrar' threw exception; nested
exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'routeControllerEndpoint' defined in
class path resource
[org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.class]:
Unsatisfied dependency expressed through method
'routeControllerEndpoint' parameter 0; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'camelContext' defined in class path resource
[org/apache/camel/spring/boot/CamelAutoConfiguration.class]:
Post-processing of merged bean definition failed; nested exception is
java.lang.IllegalStateException: Failed to introspect Class
[org.apache.camel.impl.DefaultCamelContext] from ClassLoader
[jdk.internal.loader.ClassLoaders$AppClassLoader#77556fd]

org.springframework.beans.factory.UnsatisfiedDependencyException:oracle driver not found

I am using SPRING BOOT ORACLE JPA with GRADLE a simple project but while running I am getting:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name
'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'dataSource' defined in class path resource
[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method
'dataSource' threw exception; nested exception is
java.lang.IllegalStateException: Cannot load driver class:
oracle.jdbc.driver.OracleDriver
My application.properties are:
server.port=8082 # create n drop tables, loads import.sql
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.url=jdbc:oracle:thin:#//138.69.14.63:1521/drbadev
spring.datasource.username=$$$$$$$$$$ spring.datasource.password=$$$$$$
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
What can I do to solve this?

Spring boot 2.0.1 application does not start with spring-cloud.version Finchley.RC1 but works fine with Finchley.M9

I am getting following exceptions while running a spring boot 2.0.1 application with spring clould version Finchley.RC1 but works fine if I change the version to Finchley.M9 in pom.xml as:
<spring-cloud.version>Finchley.RC1</spring-cloud.version>
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'propertySourceBootstrapConfiguration': Unsatisfied dependency expressed through field 'propertySourceLocators'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.company.configmanagement.springboot.autoconfig.CMBootstrapConfiguration$ConsulPropertySourceConfiguration': Unsatisfied dependency expressed through field 'configManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configManager' defined in com.company.configmanagement.springboot.autoconfig.ConfigManagementAutoConfiguration: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/List; | AnnotationConfigApplicationContext:558
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'propertySourceBootstrapConfiguration': Unsatisfied dependency expressed through field 'propertySourceLocators'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.company.configmanagement.springboot.autoconfig.CMBootstrapConfiguration$ConsulPropertySourceConfiguration': Unsatisfied dependency expressed through field 'configManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configManager' defined in com.company.configmanagement.springboot.autoconfig.ConfigManagementAutoConfiguration: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/List;
Looks like it was a version compatibility issue as an internal dependency was pulling guava version 14.0. For now, using the following version of dependency fixed the issue.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>

how to resolve UnsatisfiedDependencyException with spring boot hibernate?

I am getting the following issue when Spring boot hibernates Connection.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookController': Unsatisfied dependency expressed through field 'bookService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookServiceImp': Unsatisfied dependency expressed through field 'bookDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookDaoImp': Unsatisfied dependency expressed through field 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSessionFactory' defined in class path resource [com/go/myapp/Config/AppConfig.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
If you are building your project with maven look for the pom file. when you add dependencies there are Compile Dependencies for those dependencies. For an Example SpringBoot Starter 1.5.8.Release has https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter/1.5.8.RELEASE
SpringBoot 1.5.8.Release
SpringCore 4.3.12.Release
So please check your dependencies and there compile dependencies .
posting your POM file would help

(Spring 4.3.3-Hibernate 5.1.5)Unable to create sessionFactory object

Hi I am new to Hibernate and I am trying to integrate Spring 4.3.3 with Hibernate 5.1.5.
I am getting the following exception:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'loginController': Unsatisfied
dependency expressed through field 'loginservice'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'loginServiceImpl': Unsatisfied
dependency expressed through field 'loginDAO'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'loginDAOImpl': Unsatisfied dependency
expressed through field 'hibernateTemplate'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'hibernateTemplate' defined in ServletContext
resource [/WEB-INF/db-config.xml]: Cannot resolve reference to bean
'sessionFactory' while setting constructor argument; nested exception
is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'sessionFactory' defined in ServletContext
resource [/WEB-INF/db-config.xml]: Invocation of init method failed;
nested exception is org.hibernate.MappingException: Could not get
constructor for
org.hibernate.persister.entity.SingleTableEntityPersister
My DB config file:
db-config.xml
Could someone please help me to solve this problem.

Resources