title: Can't access resources/ when deploying Spring Boot application to WebLogic
body: <p>When I run my application on the embedded tomcat server shipped with spring, I can access my static resources just fine. When I package the application as a WAR, and deploy it to WebLogic, it can't find the resources.</p>
  <p>It is able to return the <code>index.html</code> via the controller, but actually accessing the resources directly by their mapping returns <code>404</code>. WebLogic also isn't recognizing the WEB-INF/weblogic.xml, as I'm not able to access the page by the <code>context-root</code> I've specified.</p>
  <hr />
  <h3>Directory Structure.</h3>
  <p><a href="https://i.stack.imgur.com/KrrEy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KrrEy.png" alt="Directory Structure" /></a></p>
  <hr />
  <h3><code>SpringLdapApplication.java</code></h3>
  <pre><code>@SpringBootApplication
  public class SpringLdapApplication extends SpringBootServletInitializer implements WebApplicationInitializer {
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(SpringLdapApplication.class);
      }
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(SpringLdapApplication.class, args);
      }
  }
  </code></pre>
  <hr />
  <h3><code>HomeController.java</code></h3>
  <pre><code>@Controller
  public class HomeController {
  
      @RequestMapping(value = &quot;/&quot;)
      public String index() {
          return &quot;index.html&quot;;
      }
  }
  </code></pre>
  <hr />
  <h3><code>pom.xml</code></h3>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;group.id&lt;/groupId&gt;
      &lt;artifactId&gt;spring-ldap&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;name&gt;spring-ldap&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot with LDAP&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.5.2.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;spring-dev-server&lt;/id&gt;
              &lt;activation&gt;
                  &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
              &lt;/activation&gt;
              &lt;dependencies&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;/dependencies&gt;
          &lt;/profile&gt;
          &lt;profile&gt;
              &lt;id&gt;weblogic&lt;/id&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
                      &lt;exclusions&gt;
                          &lt;exclusion&gt;
                              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                              &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
                          &lt;/exclusion&gt;
                      &lt;/exclusions&gt;
                  &lt;/dependency&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-log4j&lt;/artifactId&gt;
                      &lt;version&gt;1.2.2.RELEASE&lt;/version&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;/profile&gt;
      &lt;/profiles&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
              &lt;version&gt;3.5&lt;/version&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;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addDefaultImplementationEntries&gt;false&lt;/addDefaultImplementationEntries&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>