Search code examples
javaspring-mvcherokuwarprogram-entry-point

How to run a .war without a main class from command and heroku?


I have a spring mvc, maven CRUD webapp without a main class, and no executable classes. It has a couple of .jsp pages that run when called from Controller class.

It has Appinitializer which i guess uses Spring MVC to start the app. It also has a class with Viewresolver which i guess configures the controller. I package it to .war .

It runs on tomcat localhost fine, but when I try to run it on commandline or heroku local web it keeps asking for main file (no main manifest attribute). any clues how to find the file to execute? I dont have any executable classes or main class.

Heres what appinitializer looks like:enter image description here


Solution

  • You need to have a Tomcat on Heroku just as you do on your local machine. Heroku offers a solution for your use-case which is described here: https://devcenter.heroku.com/articles/java-webapp-runner