title: Deploying Spring Boot war in a Tomcat
body: <p>I'm trying to deploy my Spring Boot app (war) in the standalone Tomcat server and every time I get an error about logger. Do you have any ideas about this case?</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:199)
  at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
  at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:119)
  at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:110)
  at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:69)
  at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5156)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  ... 10 more
  
  Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
  at org.jboss.logging.Slf4jLoggerProvider.getLogger(Slf4jLoggerProvider.java:29)
  at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:33)
  at org.jboss.logging.LoggerProviders.&lt;clinit&gt;(LoggerProviders.java:28)
  at org.jboss.logging.Logger.getLogger(Logger.java:2163)
  at org.jboss.logging.Logger$1.run(Logger.java:2263)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.jboss.logging.Logger.getMessageLogger(Logger.java:2227)
  at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
  at org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:29)
  at org.hibernate.validator.internal.util.Version.&lt;clinit&gt;(Version.java:27)
  at org.hibernate.validator.internal.engine.ConfigurationImpl.&lt;clinit&gt;(ConfigurationImpl.java:66)
  at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)
  at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:276)
  at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:223)
  at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor$Jsr303ValidatorFactory.run(ConfigurationPropertiesBindingPostProcessor.java:381)
  at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.afterPropertiesSet(ConfigurationPropertiesBindingPostProcessor.java:174)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
  ... 28 more
  
  Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
  at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
  ... 46 more
  </code></pre>
  
  <p>As you can see, I'm using tomcat 8.0.24, Spring Boot 1.2.5.RELEASE, and java.version 1.7.<br>
  My project is very simple (it is working as a jar):  </p>
  
  <p><strong>1. Main app</strong>:  </p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan
  public class Application extends SpringBootServletInitializer {
  
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
  
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
  }
  </code></pre>
  
  <p><strong>2. Controller</strong></p>
  
  <pre><code>@Controller
  public class IndexController {
  
    @RequestMapping(value = {"", "/", "/home"})
    String index() {
        return "index";
    }
  }
  //index.html is in the tamplates folder.
  </code></pre>
  
  <p><strong>3. Pom.xml</strong></p>
  
  <pre><code>&lt;groupId&gt;org.test&lt;/groupId&gt;
  &lt;artifactId&gt;demo&lt;/artifactId&gt;
  &lt;version&gt;1&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;name&gt;demo&lt;/name&gt;
  &lt;description&gt;HelloWorld&lt;/description&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.2.5.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt;
  &lt;/parent&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;java.version&gt;1.7&lt;/java.version&gt;
      &lt;!--&lt;start-class&gt;demo.Application&lt;/start-class&gt;--&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  ... etc
  </code></pre>
  
  <p><code>application.properties</code> are clean.</p>