title: "SLF4J: Class path contains multiple SLF4J bindings" error when deploying the Spring example application to Cloud Foundry
body: <p>I'm trying to deploy the <a href="https://github.com/naturalprogrammer/np-spring-tutorial/tree/tmp1" rel="nofollow noreferrer">tmp1 branch</a> of the <em>Spring example application (A Spring Boot 1.3.4 application using JSP and having WAR packaging)</em> to Pivotal Cloud Foundry, using STS Boot Dashboard. I have created a manifest.yml file, looking as below:</p>
  
  <pre><code>---
  applications:
  - name: np-spring-tutorial
    buildpack: https://github.com/cloudfoundry/java-buildpack.git
    path: target/spring-tutorial-0.0.1-SNAPSHOT.war
    env:
      application_url: http://np-spring-tutorial.cfapps.io
    timeout: 180
  </code></pre>
  
  <p>The application gets deployed and seems to be running well; I'm able to view the pages. However, when starting it gives :SLF4J: Class path contains multiple SLF4J bindings" error. Here is the log:</p>
  
  <pre><code>[9 May, 2016 11:18:31 AM - Boot Dashboard] - Creating application: np-spring-tutorial
  [9 May, 2016 11:18:38 AM - Boot Dashboard] - Verifying that the application was created successfully: np-spring-tutorial
  Updated app with guid 7a95bd52-1c14-461b-a6df-59aeb7ba285a ({"environment_json"=&gt;"PRIVATE DATA HIDDEN"})
  [9 May, 2016 11:19:08 AM - Boot Dashboard] - Generating archive for application: np-spring-tutorial
  [9 May, 2016 11:19:08 AM - Boot Dashboard] - Uploading archive to Cloud Foundry for application: np-spring-tutorial
  [9 May, 2016 11:19:57 AM - Boot Dashboard] - Archive uploaded to Cloud Foundry for application: np-spring-tutorial
  [9 May, 2016 11:20:02 AM - Boot Dashboard] - Starting application: np-spring-tutorial
  [9 May, 2016 11:20:09 AM - Boot Dashboard] - Checking if the application is running. Please wait...
  Updated app with guid 7a95bd52-1c14-461b-a6df-59aeb7ba285a ({"state"=&gt;"STARTED"})
  Creating container
  Successfully created container
  Downloading app package...
  Downloaded app package (45.5M)
  Staging...
  -----&gt; Java Buildpack Version: 78c3d0a | https://github.com/cloudfoundry/java-buildpack.git#78c3d0a
  -----&gt; Downloading Open Jdk JRE 1.8.0_91-unlimited-crypto from https://download.run.pivotal.io/openjdk/trusty/x86_64/openjdk-1.8.0_91-unlimited-crypto.tar.gz (1.9s)
         Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.1s)
  -----&gt; Downloading Open JDK Like Memory Calculator 2.0.2_RELEASE from https://download.run.pivotal.io/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz (0.0s)
         Memory Settings: -Xss1M -Xmx768M -XX:MaxMetaspaceSize=104857K -Xms768M -XX:MetaspaceSize=104857K
  -----&gt; Downloading Container Customizer 1.0.0_RELEASE from https://download.run.pivotal.io/container-customizer/container-customizer-1.0.0_RELEASE.jar (0.0s)
  Exit status 0
  Staging complete
  Uploading droplet, build artifacts cache...
  Uploading build artifacts cache...
  Uploading droplet...
  Uploaded build artifacts cache (45.4M)
  Uploaded droplet (91.1M)
  Creating container
  Successfully created container
  Starting health monitoring of container
  SLF4J: Class path contains multiple SLF4J bindings.
  SLF4J: Found binding in [jar:file:/home/vcap/app/WEB-INF/lib/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: Found binding in [jar:file:/home/vcap/app/WEB-INF/lib/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  Failed to instantiate [ch.qos.logback.classic.LoggerContext]
  Reported exception:
  java.lang.AbstractMethodError: ch.qos.logback.classic.pattern.EnsureExceptionHandling.process(Lch/qos/logback/core/Context;Lch/qos/logback/core/pattern/Converter;)V
      at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:85)
      at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28)
      at ch.qos.logback.classic.BasicConfigurator.configure(BasicConfigurator.java:50)
      at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:164)
      at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
      at org.slf4j.impl.StaticLoggerBinder.&lt;clinit&gt;(StaticLoggerBinder.java:55)
      at org.slf4j.LoggerFactory.bind(LoggerFactory.java:140)
      at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:119)
      at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:328)
      at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:280)
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
      at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:273)
      at org.springframework.boot.SpringApplication.&lt;clinit&gt;(SpringApplication.java:191)
      at com.naturalprogrammer.spring.tutorial.NpSpringTutorialApplication.main(NpSpringTutorialApplication.java:14)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
      at java.lang.Thread.run(Thread.java:745)
  SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
  Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
      ... 1 more
  Caused by: java.lang.AbstractMethodError: ch.qos.logback.classic.pattern.EnsureExceptionHandling.process(Lch/qos/logback/core/Context;Lch/qos/logback/core/pattern/Converter;)V
      at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:85)
      at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28)
      at org.springframework.boot.logging.logback.LogbackConfigurator.start(LogbackConfigurator.java:112)
      at org.springframework.boot.logging.logback.DefaultLogbackConfiguration.consoleAppender(DefaultLogbackConfiguration.java:121)
      at org.springframework.boot.logging.logback.DefaultLogbackConfiguration.apply(DefaultLogbackConfiguration.java:78)
      at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadDefaults(LogbackLoggingSystem.java:124)
      at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:74)
      at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:49)
      at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:106)
      at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:262)
      at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:233)
      at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
      at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:176)
      at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
      at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
      at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119)
      at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
      at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
      at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
      at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:330)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
      at com.naturalprogrammer.spring.tutorial.NpSpringTutorialApplication.main(NpSpringTutorialApplication.java:14)
      ... 6 more
  Exit status 0
  Exit status 0
  App instance exited with guid 7a95bd52-1c14-461b-a6df-59aeb7ba285a payload: {"instance"=&gt;"3c98e26d-7714-45b8-6152-df1ae08c2025", "index"=&gt;0, "reason"=&gt;"CRASHED", "exit_description"=&gt;"2 error(s) occurred:\n\n* 2 error(s) occurred:\n\n* Codependent step exited\n* cancelled\n* cancelled", "crash_count"=&gt;1, "crash_timestamp"=&gt;1462773044776529510, "version"=&gt;"8cf24bda-13e6-49a6-8b52-906440c1b780"}
  Creating container
  Successfully created container
  SLF4J: Class path contains multiple SLF4J bindings.
  SLF4J: Found binding in [jar:file:/home/vcap/app/WEB-INF/lib/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: Found binding in [jar:file:/home/vcap/app/WEB-INF/lib/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
    .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v1.3.4.RELEASE)
  2016-05-09 05:50:52.875  INFO 29 --- [           main] pertySourceApplicationContextInitializer : Adding 'cloud' PropertySource to ApplicationContext
  2016-05-09 05:50:52.963  INFO 29 --- [           main] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
  2016-05-09 05:50:52.978  INFO 29 --- [           main] c.n.s.t.NpSpringTutorialApplication      : Starting NpSpringTutorialApplication on ip3ju5q5j6m with PID 29 (/home/vcap/app/WEB-INF/classes started by vcap in /home/vcap/app)
  ...
  2016-05-09 05:51:07.749  INFO 29 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  2016-05-09 05:51:08.376  INFO 29 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
  Container became healthy
  2016-05-09 05:51:08.720  INFO 29 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
  2016-05-09 05:51:10.014  INFO 29 --- [           main] c.n.s.t.NpSpringTutorialApplication      : Started NpSpringTutorialApplication in 18.612 seconds (JVM running for 19.599)
  [9 May, 2016 11:21:22 AM - Boot Dashboard] - Application appears to have started - np-spring-tutorial
  </code></pre>
  
  <p>Any idea how to fix this? (This question has originated from <a href="https://stackoverflow.com/questions/37089561/error-deploying-the-example-application-spring-boot-1-3-4-jsp-war-packaging/37093413?noredirect=1#comment61757433_37093413">this one</a>)</p>
  
  <p><strong>Update</strong></p>
  
  <p>As recommended by Gemini, checking the WAR, I indeed see two logback-classic-x.x.x.jars:</p>
  
  <p><a href="https://i.stack.imgur.com/HnGtz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HnGtz.png" alt="enter image description here"></a></p>
  
  <p>However, looking at the maven dependency tree, I see only the 1.1.7 version of logback, as below:</p>
  
  <p><a href="https://i.stack.imgur.com/JF0co.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JF0co.png" alt="enter image description here"></a></p>
  
  <p>So, what could be going wrong? Maybe the <code>spring-boot-maven-plugin</code> is doing something?</p>