I am using io.springfox 3.0.0 version in my project. I added the dependency to my build.gradle file as following:
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
The external libraries were created as expected:
io.springfox:springfox-boot-starter:3.0.0
io.springfox:springfox-core:3.0.0
io.springfox:springfox-data-rest:3.0.0
io.springfox:springfox-oas:3.0.0
io.springfox:springfox-schema:3.0.0
io.springfox:springfox-spi:3.0.0
io.springfox:springfox-spring-web:3.0.0
io.springfox:springfox-spring-web-flux:3.0.0
io.springfox:springfox-spring-web-mvc:3.0.0
io.swagger.core.v3:swagger-annotation:2.1.2
io.swagger.core.v3:swagger-models:2.1.2
I am using Spring Boot 2.4.2 and Java 11.
When I run my Spring boot application, I get the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'swagger2ControllerWebMvc' defined in URL [jar:file:/opt/rally/dynamicscreen-service/lib/springfox-swagger2.jar!/springfox/documentation/swagger2/web/Swagger2ControllerWebMvc.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jsonSerializer' defined in springfox.documentation.spring.web.SpringfoxWebConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.spring.web.json.JsonSerializer]: Factory method 'jsonSerializer' threw exception; nested exception is java.lang.NoClassDefFoundError: io/swagger/v3/oas/models/OpenAPI
Where could I be doing wrong?
Related
getting below error while trying to execute grapgql 0.0.4 with spring boot 2.7.0 & higher and Java 17.
Error creating bean with name 'graphQLSchema' defined in class path resource [io/leangen/graphql/spqr/spring/autoconfigure/SpqrAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [graphql.schema.GraphQLSchema]: Factory method 'graphQLSchema' threw exception; nested exception is java.lang.NoClassDefFoundError: graphql/execution/batched/Batched
I am trying to upgrade from spring boot 2.4.6 to 2.5.4 and have started receiving following error
Error starting ApplicationContext. To display the conditions report
re-run your application with 'debug' enabled. 2021-09-28 14:10:37
[main] ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'supplierInitializer' defined in class path
resource
[org/springframework/cloud/stream/function/FunctionConfiguration.class]:
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'inMemorySwaggerResourcesProvider_integrationflow.org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0':
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'integrationGlobalProperties' defined in class
path resource
[org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.integration.context.IntegrationProperties]:
Factory method 'integrationGlobalProperties' threw exception; nested
exception is java.lang.IllegalAccessError: class
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
tried to access private method 'void
org.springframework.integration.context.IntegrationProperties.()'
(org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
and org.springframework.integration.context.IntegrationProperties are
in unnamed module of loader 'app')
Not able to understand what has changed in spring boot 2.5.X , although upgrading till version 2.4.11 works fine.
I guess you have an old version of spring-integration-core library. Delete all the folders under .m2/repository/org/springframework/integration That should fix it.
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]
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
I have a spring boot app that I am trying to add an oracle connection to. I have already added an #Entity class and Repository.
I have added the oracle ojdbc8.jar to my local maven repo and have this in gradle
dependencies {
...
compile group: 'com.oracle', name: 'ojdbc8', version:'12.2.0'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.5.3.RELEASE'
...
}
my application.properties contains
spring.datasource.url="jdbc:oracle:thin:#//hostname.whatever:1521/blah"
spring.datasource.username="username"
spring.datasource.password="password"
spring.datasource.driver-class-name="oracle.jdbc.OracleDriver"
This all compiles fine. But when I deploy (under tomcat) I get
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': 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$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: "oracle.jdbc.OracleDriver"
Looks like it's having trouble finding the driver. Is there something else I need to do to make it know where to find it? Or to build it as part of the archive?
I also built a similar test app and pointed it at a local mysql just to make sure I wasn't crazy and that works fine... Not sure what's so special about oracle.