title: Failed to deploy Simple Spring MVC project to AWS Tomcat 8
body: <p>I am recently starting a new Java web project, and is trying out the well-acclaimed Spring MVC Framework. My coding experience with Java servlet dated about 6 years ago so I am a little rusty. After 2 days of studying and testing around, I failed to deploy a simple Hello World app (built with Gradle) to a testing cloud (AWS Elastic Beanstalk with Linux and Tomcat 8). More importantly, I can't get my head around with how things really connected given all the documentations I found online.</p>
  
  <p>Here are a few questions which I couldn't find definite answers:</p>
  
  <ol>
  <li><p>How do I decide which Spring framework dependencies I should include in my build.gradle? Examples online are suggesting different things. Currently my dependencies settings are</p>
  
  <pre><code>dependencies {
      compile 'org.springframework:spring-context:4.2.4.RELEASE'
      compile 'org.aspectj:aspectjrt:1.7.4'
      compile 'ch.qos.logback:logback-classic:1.1.3'
      compile 'javax.servlet:jstl:1.2'
  }
  </code></pre>
  
  <p>and my source files are only two simple Java files:</p>
  
  <p>{project_root}/src/main/java/test/Greeter.java</p>
  
  <pre><code>package test;
  
  public class Greeter {
    public String sayHello() {
      return "Hello world!";
    }
  }
  </code></pre>
  
  <p>{project_root}/src/main/java/test/HelloWorld.java</p>
  
  <pre><code>package test;
  
  public class HelloWorld {
      public static void main(String[] args) {
          Greeter greeter = new Greeter();        
          System.out.println(greeter.sayHello());
      }
  }
  </code></pre>
  
  <p>gradle build is successful so far.</p></li>
  <li><p>Where should I store my JSP files (Views)? </p></li>
  <li><p>How should I configure <code>web.xml</code>, and any other XMLs that are required to tell Tomcat where the files are located? Where should I store these XMLs?</p></li>
  <li><p>How should I configure <code>build.gradle</code> to compile a .war file that has all the resources needed to run my Spring web app on Tomcat? My current <code>build.gradle</code> is as below:</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'war'
  
  
  repositories {
      mavenLocal()
      mavenCentral()
  }
  
  sourceCompatibility = 1.8
  targetCompatibility = 1.8
  
  war {
      version = '0.4'
      baseName = 'collaborative-system'
  }  
  project.webAppDirName = 'webapp'
  
  dependencies {
      compile 'org.springframework:spring-context:4.2.4.RELEASE'
      compile 'org.aspectj:aspectjrt:1.7.4'
      compile 'ch.qos.logback:logback-classic:1.1.3'
      compile 'javax.servlet:jstl:1.2'
  }
  
  sourceSets {
      main {
          java {
              srcDir 'src'
          }
      }
  }
  
  
  task wrapper(type: Wrapper) {
      gradleVersion = '2.3'
  }
  </code></pre></li>
  </ol>
  
  <p>Server is now showing a 404 page with the .war file built.</p>