title: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean
body: <p>Maven build succeeded but when I trying to run it fails with: </p>
  
  <pre><code>Error: Could not find or load main class app.jar
  </code></pre>
  
  <p>I have in <code>resources/META-INF/MANIFEST.MF</code> with </p>
  
  <pre><code>Manifest-Version: 1.0
  Main-Class: go.Application
  </code></pre>
  
  <p>All seems in place. What's wrong?</p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;build&gt;
          &lt;plugins&gt;
               &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.5&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifestFile&gt;src/main/resources/META-INF/MANIFEST.MF&lt;/manifestFile&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
  
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>
  
  <p><strong>UPDATE1</strong></p>
  
  <p>Same story when building jar artifact with IntelliJ.</p>
  
  <p><strong>UPDATE2</strong></p>
  
  <p>OK, I managed to run it but now I have :</p>
  
  <pre><code>Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
  </code></pre>
  
  <p><strong>UPDATE3</strong></p>
  
  <p>Got it working by adding to Application.java:</p>
  
  <pre><code>@Bean
          public EmbeddedServletContainerFactory servletContainer() {
              TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
              return factory;
          }
  </code></pre>