question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsatisfied dependencies

See original GitHub issue

I am trying to use SpringFox with Swagger UI in my project, but I keep having errors that I have an unsatisfied dependencies.

here is a servlet-xml

<mvc:resources mapping="/resources/**" location="/WEB-INF/resources/"/>
    <mvc:resources mapping="swagger-ui.html"
                   location="classpath:/META-INF/resources/" />
    <mvc:resources mapping="/webjars/**"
                   location="classpath:/META-INF/resources/webjars/" />
    <context:component-scan base-package="com.trustetc.mercury"/>
    <!-- Swagger2 Config Bean -->
    <bean id="swagger2Config" class="springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration"/>

I am using OAuth2 to protect my end points.

Here is the error I keep getting.

2017-02-15 13:39:05,711 DEBUG DefaultListableBeanFactory:194 - Ignoring constructor [public springfox.documentation.schema.property.OptimizedModelPropertiesProvider(springfox.documentation.schema.property.bean.AccessorsProvider,springfox.documentation.schema.property.field.FieldProvider,springfox.documentation.schema.property.FactoryMethodProvider,com.fasterxml.classmate.TypeResolver,springfox.documentation.schema.property.BeanPropertyNamingStrategy,springfox.documentation.schema.plugins.SchemaPluginsManager,springfox.documentation.schema.TypeNameExtractor)] of bean 'optimized': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'optimized' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/OptimizedModelPropertiesProvider.class]: Unsatisfied dependency expressed through constructor parameter 4: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
2017-02-15 13:39:05,712 DEBUG DefaultListableBeanFactory:194 - Ignoring constructor [public springfox.documentation.schema.property.CachingModelPropertiesProvider(com.fasterxml.classmate.TypeResolver,springfox.documentation.schema.property.ModelPropertiesProvider)] of bean 'cachingModelPropertiesProvider': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cachingModelPropertiesProvider' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/CachingModelPropertiesProvider.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'optimized' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/OptimizedModelPropertiesProvider.class]: Unsatisfied dependency expressed through constructor parameter 4: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'optimized' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/OptimizedModelPropertiesProvider.class]: Unsatisfied dependency expressed through constructor parameter 4: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
2017-02-15 13:39:05,713 DEBUG DefaultListableBeanFactory:568 - Retrieved dependent beans for bean '(inner bean)#6f0bfe96': [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]
2017-02-15 13:39:05,713 DEBUG DefaultListableBeanFactory:568 - Retrieved dependent beans for bean '(inner bean)#360b09f7': [(inner bean)#56d41d82]
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
2017-02-15 13:39:05,714  WARN XmlWebApplicationContext:549 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cachingModelPropertiesProvider' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/CachingModelPropertiesProvider.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'optimized' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/OptimizedModelPropertiesProvider.class]: Unsatisfied dependency expressed through constructor parameter 4: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'optimized' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/OptimizedModelPropertiesProvider.class]: Unsatisfied dependency expressed through constructor parameter 4: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapperBeanPropertyNamingStrategy' defined in URL [jar:file:/C:/workspaces/Phoenix/Modules/Mercury/target/mercury-0.0.4-SNAPSHOT/WEB-INF/lib/springfox-schema-2.6.0.jar!/springfox/documentation/schema/property/ObjectMapperBeanPropertyNamingStrategy.class]: Instantiation of bean failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Feb 15, 2017

I actually resolved this by adding the following dependencies

<dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>1.7.21</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.21</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.21</version> </dependency>

When you first suggested I originally only added. <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.21</version> </dependency>

Thanks for the help!

0reactions
ghostcommented, Feb 15, 2017

maven

Read more comments on GitHub >

github_iconTop Results From Across the Web

WELD-001408: Unsatisfied dependencies for type Customer ...
Your Customer class has to be discovered by CDI as a bean. For that you have two options: Put a bean defining annotation...
Read more >
Unsatisfied Dependency in Spring - Baeldung
UnsatisfiedDependencyException gets thrown when, as the name suggests, some bean or property dependency isn't satisfied. This may happen when a ...
Read more >
Famous error WELD-001408 Unsatisfied dependencies
Hi for all !! I'm developing an app with maven + weld. And I don't inject bean on my Servlet. Below follows the...
Read more >
PI71667: Application fails with WELD-001408 - IBM
PI71667: Application fails with WELD-001408: Unsatisfied dependencies for type Validator with qualifiers @Default. Fixes are available.
Read more >
Unsatisfied dependencies for type [...] with qualifiers ... - GitHub
If I start the application in a Payara Micro, the application starts up and works perfectly. However, I get a warning: Component of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found