title: Deploy Spring boot and angular project to weblogic 12c
body: <p>I am trying to deploy a spring-boot application with angular as the frontend on weblogic 12c (12.2.1). My code is available at - <a href="https://github.com/onkar0777/Angular-SpringBoot-REST-JWT" rel="nofollow noreferrer">https://github.com/onkar0777/Angular-SpringBoot-REST-JWT</a></p>
  
  <p>I have created a war with mvn clean install and it runs fine on running with java -jar </p>
  
  <p>But when I deploy the same war to weblogic, on hitting <a href="http://192.168.1.6:7001/myweb" rel="nofollow noreferrer">http://192.168.1.6:7001/myweb</a> I get the error (myweb is context-root)</p>
  
  <blockquote>
    <p>Whitelabel Error Page This application has no explicit mapping for
    /error, so you are seeing this as a fallback.</p>
    
    <p>Wed Aug 22 13:28:58 IST 2018 There was an unexpected error
    (type=Forbidden, status=403). Access Denied</p>
  </blockquote>
  
  <p>I am guessing somehow weblogic is not directing calls to the MainController</p>
  
  <pre><code>package com.app.api;
  import org.springframework.stereotype.*;
  import org.springframework.web.bind.annotation.*;
  import springfox.documentation.annotations.*;
  
  @ApiIgnore
  @Controller // Dont use RestController as this method is mapping to a static file not a JSON
  public class MainController {
  
    @RequestMapping(value={"/"})
      public String index() {
          return "index.html";
      }
  
  }
  </code></pre>
  
  <p>MainApp.java</p>
  
  <pre><code>package com.app;
  
  import javax.annotation.Resource;
  
  import org.springframework.boot.Banner;
  import org.springframework.boot.CommandLineRunner;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.autoconfigure.domain.EntityScan;
  import org.springframework.boot.builder.SpringApplicationBuilder;
  import org.springframework.boot.web.support.SpringBootServletInitializer;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  import org.springframework.transaction.annotation.EnableTransactionManagement;
  import org.springframework.web.WebApplicationInitializer;
  
  import com.app.services.StorageService;
  
  
  @SpringBootApplication
  @EnableJpaRepositories(basePackages ={ "com.app.repo"})
  @EntityScan(basePackages ={ "com.app.model"})
  @EnableTransactionManagement
  public class MainApp extends SpringBootServletInitializer implements CommandLineRunner, WebApplicationInitializer {
      @Resource
      StorageService storageService;
  
      @Override
      public void run(String... arg) throws Exception {
          storageService.deleteAll();
          storageService.init();
      }
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
          return configureApplication(builder);
      }
  
      public static void main(String[] args) {
          configureApplication(new SpringApplicationBuilder()).run(args);
      }
  
      private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) {
          return builder.sources(MainApp.class).bannerMode(Banner.Mode.OFF);
      }
  
  }
  </code></pre>
  
  <p>weblogic.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;wls:weblogic-web-app
      xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
          http://xmlns.oracle.com/weblogic/weblogic-web-app
          http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd"&gt;
      &lt;wls:context-root&gt;/myweb&lt;/wls:context-root&gt;
      &lt;wls:container-descriptor&gt;
          &lt;wls:prefer-web-inf-classes&gt;true&lt;/wls:prefer-web-inf-classes&gt;
      &lt;/wls:container-descriptor&gt;
  &lt;/wls:weblogic-web-app&gt;
  </code></pre>