404 error after deploying web app to AWS Elastic beanstalk

Viewed 496

I am receiving a 404 error after deploying my AWS Application to Elastic beanstalk

NOTE THE PROJECT RUNS FINE LOCALLY

I think the issue is, it is unable to find my html files (thats why it is throwing a 404).

These are the steps I have taken

  1. I have built an .JAR artifact using Intellij(I think there is a mistake in this process).
  2. I then selected Tomcat as my environment running Amazon Corretto 11.
  3. I then uploaded my said .JAR file

This is how I built my .JAR

I clicked on project structure in Intellij. Which opens this window. Window

I then clicked on the plus sign and selected JAR from modules with dependencies. This is what opens up and this is my selections.

Selection

Finally this what the what it looks like, I believe it is not picking up my resources folder, however I am not sure if this is the case

Once this is done I click Build Artifact and upload .JAR file to Amazon AWS Elastic BeanStalk What appears after JAR configuration is completed

However once this is done I get a 404

  HTTP Status 404 – Not Found
Type Status Report

Message The requested resource [/] is not available

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/8.5.63

This is my controllers

   @Controller
public class HomeController {




    @RequestMapping("/")
    public String index() throws IOException {
       return "home";
    }

    @RequestMapping("/search-country")
    public String login()
    {
        System.out.println("controller hit");
        return "Search";
    }

    @RequestMapping(value = "/home-page",method = RequestMethod.POST)
    public ModelAndView homepage(HttpServletRequest request) throws IOException {

        ApiCaller apiCaller = new ApiCaller(request.getParameter("country_text"));

        ModelAndView coronavirus = new ModelAndView("coronavirus");

        coronavirus.addObject("country_flag_url",apiCaller.getFlagURL());
        coronavirus.addObject("country_text","Cases for " + request.getParameter("country_text") + "as of " + Utils.todaysDate());
        coronavirus.addObject("total_cases_text","Cumulative Cases: " + Utils.addCommasToNumericString(apiCaller.getTotalCases()));
        coronavirus.addObject("deaths_today_text","Deaths today: " + Utils.addCommasToNumericString(apiCaller.getDeathsToday()));
        coronavirus.addObject("cases_today_text","Cases today: " + Utils.addCommasToNumericString(apiCaller.getCasesToday()));
        coronavirus.addObject("in_critical_care_text","In Intensive Care:" + Utils.addCommasToNumericString(apiCaller.getInCriticalCare()));
        coronavirus.addObject("population_text","Total Population: " +Utils.addCommasToNumericString(apiCaller.getInCriticalCare()));
        coronavirus.addObject("active_text","Active cases: " + Utils.addCommasToNumericString(apiCaller.getActiveCases()));
        coronavirus.addObject("recovered_text","Recovered Cases" + Utils.addCommasToNumericString(apiCaller.getRecovered()));
        coronavirus.addObject("deaths","Total deaths: " + Utils.addCommasToNumericString(apiCaller.getTotalCases()));




        return coronavirus;
    }

}
0 Answers
Related