title: Spring boot app deployment error: "ServletException: Failed to instantiate WebApplicationInitializer class"
body: <p>Can not deploy spring boot app on tomcat server(os hp-ux). Please any help</p>
  
  <p>MainClass:</p>
  
  <pre><code>@SpringBootApplication
  @EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class})
  public class NgrkApp extends SpringBootServletInitializer implements WebApplicationInitializer{
  
      private static final Logger log = LoggerFactory.getLogger(NgrkApp.class);
  
      private final Environment env;
  
      public NgrkApp(Environment env) {
          this.env = env;
      }
  
      @PostConstruct
      public void initApplication() {
          Collection&lt;String&gt; activeProfiles = Arrays.asList(env.getActiveProfiles());
          if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) &amp;&amp; activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) {
              log.error("You have misconfigured your application! It should not run " +
                  "with both the 'dev' and 'prod' profiles at the same time.");
          }
          if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) &amp;&amp; activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) {
              log.error("You have misconfigured your application! It should not " +
                  "run with both the 'dev' and 'cloud' profiles at the same time.");
          }
      }
      public static void main(String[] args) {
          SpringApplication app = new SpringApplication(NgrkApp.class);
          DefaultProfileUtil.addDefaultProfile(app);
          Environment env = app.run(args).getEnvironment();
          logApplicationStartup(env);
      }
  
      private static void logApplicationStartup(Environment env) {
          String protocol = "http";
          if (env.getProperty("server.ssl.key-store") != null) {
              protocol = "https";
          }
          String serverPort = env.getProperty("server.port");
          String contextPath = env.getProperty("server.servlet.context-path");
          if (StringUtils.isBlank(contextPath)) {
              contextPath = "/";
          }
          String hostAddress = "localhost";
          try {
              hostAddress = InetAddress.getLocalHost().getHostAddress();
          } catch (UnknownHostException e) {
              log.warn("The host name could not be determined, using `localhost` as fallback");
          }
          log.info("\n----------------------------------------------------------\n\t" +
                  "Application '{}' is running! Access URLs:\n\t" +
                  "Local: \t\t{}://localhost:{}{}\n\t" +
                  "External: \t{}://{}:{}{}\n\t" +
                  "Profile(s): \t{}\n----------------------------------------------------------",
              env.getProperty("spring.application.name"),
              protocol,
              serverPort,
              contextPath,
              protocol,
              hostAddress,
              serverPort,
              contextPath,
              env.getActiveProfiles());
      }
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(NgrkApp.class);
      }
  
  }
  </code></pre>
  
  <p>Stacktrace: </p>
  
  <pre><code>javax.servlet.ServletException: Failed to instantiate WebApplicationInitializer class
                  at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:158)
                  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5225)
                  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
                  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
                  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
                  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:744)
                  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:980)
                  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1851)
                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                  at java.lang.Thread.run(Thread.java:748)
          Caused by: java.lang.NoSuchMethodException: kz.ngrk.application.NgrkApp.&lt;init&gt;()
                  at java.lang.Class.getConstructor0(Class.java:3109)
                  at java.lang.Class.getDeclaredConstructor(Class.java:2182)
                  at org.springframework.util.ReflectionUtils.accessibleConstructor(ReflectionUtils.java:530)
                  at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:155)
                  ... 12 more
  </code></pre>