title: Deploy spring-boot and angular 7 application using war into tomcat 8.5
body: <p>I am trying to deploy the Angular 7  + Spring Boot application using war into tomcat. I have followed some steps to create war with angular code. War is created successfully with UI code. But I am not able to call UI code.
  When I trying to call </p>
  
  <ul>
  <li>localhost:8080/war-name</li>
  <li>localhost:8080/war-name/index.html</li>
  <li>localhost:8080/index.html</li>
  </ul>
  
  <p>it shows <code>404</code>.</p>
  
  <p>Web services are working properly. I can able to call them.</p>
  
  <p>How I can call <code>index.html</code> of my application?</p>
  
  <p><strong>Note</strong>:-  I am not using <code>spring-boot-starter-web</code></p>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&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;2.1.3.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.hackthon&lt;/groupId&gt;
      &lt;artifactId&gt;pmoconnect&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;pmoconnect&lt;/name&gt;
      &lt;description&gt;PMO Connect&lt;/description&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;start-class&gt;com.hackthon.HackthonApplication&lt;/start-class&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&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-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jersey&lt;/artifactId&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;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;scope&gt;runtime&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;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
              &lt;artifactId&gt;poi&lt;/artifactId&gt;
              &lt;version&gt;4.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- excel 2007 over --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
              &lt;artifactId&gt;poi-ooxml&lt;/artifactId&gt;
              &lt;version&gt;4.0.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-multipart&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.mail&lt;/groupId&gt;
              &lt;artifactId&gt;javax.mail&lt;/artifactId&gt;
              &lt;version&gt;1.5.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-envers&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.github.eirslett&lt;/groupId&gt;
                  &lt;artifactId&gt;frontend-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.3&lt;/version&gt;
  
                  &lt;configuration&gt;
                      &lt;nodeVersion&gt;v8.11.3&lt;/nodeVersion&gt;
                      &lt;npmVersion&gt;6.3.0&lt;/npmVersion&gt;
                      &lt;workingDirectory&gt;src/main/ngapp/&lt;/workingDirectory&gt;
                  &lt;/configuration&gt;
  
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;install node and npm&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;install-node-and-npm&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
  
                      &lt;execution&gt;
                          &lt;id&gt;npm install&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;npm&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
  
                      &lt;execution&gt;
                          &lt;id&gt;npm run build&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;npm&lt;/goal&gt;
                          &lt;/goals&gt;
  
                          &lt;configuration&gt;
                              &lt;arguments&gt;run build&lt;/arguments&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                      &lt;execution&gt;
                          &lt;id&gt;prod&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;npm&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;arguments&gt;run-script build&lt;/arguments&gt;
                          &lt;/configuration&gt;
                          &lt;phase&gt;generate-resources&lt;/phase&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;copy-resources&lt;/id&gt;
                          &lt;phase&gt;validate&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy-resources&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;${project.build.directory}/classes/static/&lt;/outputDirectory&gt;
                              &lt;!-- &lt;outputDirectory&gt;${project.build.directory}/../src/main/resources/static/&lt;/outputDirectory&gt; --&gt;
                              &lt;resources&gt;
                                  &lt;resource&gt;
                                      &lt;directory&gt;/src/main/ngapp/dist/&lt;/directory&gt;
                                  &lt;/resource&gt;
                              &lt;/resources&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;/plugin&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;packagingExcludes&gt;WEB-INF/lib/tomcat-*.jar&lt;/packagingExcludes&gt;
                      &lt;warName&gt;pmoconnect&lt;/warName&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>spring.datasource.url = jdbc:mysql://localhost:3306/elite_db?allowPublicKeyRetrieval=true&amp;useSSL=false
  spring.datasource.username = &lt;username&gt;
  spring.datasource.password = &lt;password&gt;
  
  
  ## Hibernate Properties
  # The SQL dialect makes Hibernate generate better SQL for the chosen database
  spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
  spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
  
  # Hibernate ddl auto (create, create-drop, validate, update)
  spring.jpa.hibernate.ddl-auto = update
  org.hibernate.envers.audit_table_suffix = _AUDIT_LOG
  </code></pre>
  
  <p><strong>HackthonApplication.java</strong></p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan
  public class HackthonApplication {
      public static void main(String[] args) {
          SpringApplication.run(HackthonApplication.class, args);
      }
  }
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;PMO Connect&lt;/title&gt;
    &lt;base href="./"&gt;
  
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;link rel="icon" type="image/x-icon" href="favicon.ico"&gt;
    &lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"&gt;
  &lt;/head&gt;
   &lt;body&gt;
    &lt;app-root&gt;&lt;/app-root&gt;
    &lt;script type="text/javascript" src="runtime.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="es2015-polyfills.js" nomodule&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="polyfills.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="styles.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="vendor.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="main.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>war file</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Bcc4H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Bcc4H.png" alt="war file"></a></p>
  
  <p><strong>tomcat logs</strong></p>
  
  <pre><code>2019-03-27 10:34:19.134  INFO 18464 --- [ost-startStop-2] com.hackthon.HackthonApplication         : No active profile set, falling back to default profiles: default
      2019-03-27 10:34:19.291  INFO 18464 --- [ost-startStop-2] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
      2019-03-27 10:34:22.558  INFO 18464 --- [ost-startStop-2] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
      2019-03-27 10:34:22.977  INFO 18464 --- [ost-startStop-2] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 372ms. Found 6 repository interfaces.
      2019-03-27 10:34:24.386  INFO 18464 --- [ost-startStop-2] o.a.c.c.C.[.[localhost].[/pmoconnect]    : Initializing Spring embedded WebApplicationContext
      2019-03-27 10:34:24.386  INFO 18464 --- [ost-startStop-2] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5094 ms
      2019-03-27 10:34:24.809  INFO 18464 --- [ost-startStop-2] o.s.b.a.jersey.JerseyAutoConfiguration   : Configuring existing registration for Jersey servlet 'com.hackthon.config.JerseyConfiguration'
      2019-03-27 10:34:25.046  INFO 18464 --- [ost-startStop-2] o.s.boot.web.servlet.RegistrationBean    : Servlet com.hackthon.config.JerseyConfiguration was not registered (possibly already registered?)
      2019-03-27 10:34:25.628  INFO 18464 --- [ost-startStop-2] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
      2019-03-27 10:34:26.473  INFO 18464 --- [ost-startStop-2] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
      2019-03-27 10:34:26.815  INFO 18464 --- [ost-startStop-2] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
          name: default
          ...]
      2019-03-27 10:34:27.465  INFO 18464 --- [ost-startStop-2] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.7.Final}
      2019-03-27 10:34:27.472  INFO 18464 --- [ost-startStop-2] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
      2019-03-27 10:34:28.996  INFO 18464 --- [ost-startStop-2] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
      2019-03-27 10:34:30.597  INFO 18464 --- [ost-startStop-2] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
      2019-03-27 10:34:30.951  INFO 18464 --- [ost-startStop-2] o.h.e.boot.internal.EnversServiceImpl    : Envers integration enabled? : true
      2019-03-27 10:34:41.272  INFO 18464 --- [ost-startStop-2] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
      2019-03-27 10:34:43.158  INFO 18464 --- [ost-startStop-2] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
      2019-03-27 10:34:46.554  INFO 18464 --- [ost-startStop-2] com.hackthon.HackthonApplication         : Started HackthonApplication in 29.239 seconds (JVM running for 143.14)
      2019-03-27 10:34:46.944  INFO 18464 --- [ost-startStop-2] org.apache.jasper.servlet.TldScanner     : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
      2019-03-27 10:34:50.219  WARN 18464 --- [ost-startStop-2] org.glassfish.jersey.internal.Errors     : The following warnings have been detected: WARNING: A HTTP GET method, public javax.ws.rs.core.Response com.hackthon.service.WSFGMapping.getMappings(java.lang.String), should not consume any entity.
  
      2019-03-27 10:34:50.348  INFO 18464 --- [ost-startStop-2] org.apache.catalina.startup.HostConfig   : Deployment of web application archive [C:\Users\kaukhare\myWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\webapps\pmoconnect.war] has finished in [68,229] ms
  </code></pre>