title: Spring reactive boot app (2.0.0.RC1) as servlet in WebLogic 12c starts but NPE thrown on access
body: <p>Running Spring boot reactive application based off of 2.0.0.RC1. It works by itself with a netty embedded container just fine.</p>
  
  <p>Switching it to a servlet, sorting out the dependencies - exclusions, provisions, weblogic.xml instructions etc, then deploying to WebLogic 12c (12.1.3) container will start the application successfully. However when trying to access the rest url, handled by a single controller, WebLogic throws NPE. It never reaches Spring controller.</p>
  
  <pre><code>Error 500--Internal Server Error
  java.lang.NullPointerException
      at weblogic.servlet.internal.ServletResponseImpl.sendContentError(ServletResponseImpl.java:713)
      at weblogic.servlet.internal.ServletResponseImpl.sendError(ServletResponseImpl.java:761)
      at weblogic.servlet.internal.ServletResponseImpl.sendError(ServletResponseImpl.java:693)
      at org.springframework.boot.web.servlet.support.ErrorPageFilter.handleErrorStatus(ErrorPageFilter.java:144)
      at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:117)
      at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
      at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3451)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.__run(WebAppServletContext.java:3417)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
      at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2280)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2196)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1632)
      at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:256)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
  </code></pre>
  
  <p>I will paste the excerpts of all relevant sources below. First boot app:</p>
  
  <pre><code>@SpringBootApplication
  @Configuration
  //@EnableAutoConfiguration
  //@ComponentScan(basePackages = {"ca.corp.uservice", "ca.corp.uservice.filecache"})
  //@ImportResource({"/WEB-INF/ws-dispatcher-servlet.xml"})
  //@EnableWebSecurity
  public class FileCacheBootApp extends SpringBootServletInitializer implements WebApplicationInitializer {
  
    public static void main(String[] args) {
      SpringApplication.run(FileCacheBootApp.class, args);
    }
  
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
      return application.sources(FileCacheBootApp.class);
    }
    ...
  }
  </code></pre>
  
  <p>Next the controller:</p>
  
  <pre><code>@RestController
  @RequestMapping("/filecache")
  public class FileCacheController implements FileCacheApi {
  
    @Autowired
    private FileCacheRepository repo;
  
    // -------------- GET ---------------
  
    @GetMapping(value = "{token}")
    @Override public Mono&lt;FileCacheable&gt; get(@PathVariable("token") String token) {
      return repo.findByToken(token).map(f -&gt; load(f));
    }
  
    @GetMapping(value = "app")
    @Override public Mono&lt;FileCacheable&gt; get(@RequestParam Long appid, @RequestParam String type, @RequestParam Integer langcode) {
      return repo.findByUnique(appid, type, langcode).map(f -&gt; load(f));
     }
  
    @GetMapping(value = "zip")
    @Override public Mono&lt;FileCacheable&gt; get(@RequestParam String name, @RequestParam Integer langcode) {
      return repo.findByNameAndLang(name, langcode);
    }
    ...
  }
  </code></pre>
  
  <p>And finally pom, spring fmw and servlet. Needed to do some jumps here to get it to run w/o conflicts in WebLogic container.</p>
  
  <pre><code>    &lt;!-- SPRING FRAMEWORK --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;version&gt;${spring-boot-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j-to-slf4j&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
          &lt;version&gt;2.0.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-to-slf4j&lt;/artifactId&gt;
          &lt;version&gt;2.0.2&lt;/version&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;version&gt;${spring-boot-version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-mongodb-reactive&lt;/artifactId&gt;
          &lt;version&gt;${spring-boot-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-webflux&lt;/artifactId&gt;
          &lt;version&gt;${spring-boot-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.hibernate.validator&lt;/groupId&gt;
                  &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;!-- SERVLET, VALIDATION and EL --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.el&lt;/groupId&gt;
          &lt;artifactId&gt;javax.el-api&lt;/artifactId&gt;
          &lt;version&gt;3.0.1-b04&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish&lt;/groupId&gt;
          &lt;artifactId&gt;javax.el&lt;/artifactId&gt;
          &lt;version&gt;3.0.1-b09&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;version&gt;5.1.1.Final&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Weblogic.xml</p>
  
  <pre><code>&lt;weblogic-version&gt;12.1.3&lt;/weblogic-version&gt;
  
  &lt;context-root&gt;file-cache-uservice&lt;/context-root&gt;
  
  &lt;container-descriptor&gt;
      &lt;prefer-application-packages&gt;
          &lt;package-name&gt;org.springframework.*&lt;/package-name&gt;
          &lt;package-name&gt;org.hibernate.*&lt;/package-name&gt;
          &lt;package-name&gt;javax.validation.*&lt;/package-name&gt;
          &lt;package-name&gt;javax.validation.spi.*&lt;/package-name&gt;
          &lt;package-name&gt;org.apache.logging.log4j.*&lt;/package-name&gt;
          &lt;package-name&gt;org.slf4j.*&lt;/package-name&gt;
      &lt;/prefer-application-packages&gt;
  &lt;/container-descriptor&gt;
  </code></pre>
  
  <p>I am trying to be as specific as possible w/o being an info overkill. If you'd like to know more details though... be glad to provide.</p>
  
  <p>Any info or a pointer on the source of the NPE is appreciated.</p>