Hi,
I have been building an app on top of the helloworld-springboot tutorial. It is working great for APIs, but I wanted to add JSP support to include a simple admin console.
So I modified the helloworld-springboot project as following:
- Built a WEB-INF structure under src/main/webapp, including a jsp directory
- Modified application.properties to add spring.mvc.view.prefix and spring.mvc.view.suffix configuration that points to the directories in (1)
- Added dependencies to the pom.xml file for tomcat and jstl
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>9.0.12</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
4. Added a new @controller to SpringBoot, with the corresponding @GetMapping(s)
Running locally with mvn spring-boot:run works great, including JSP rendering, redirections, etc.
Now, when I deploy to GAE flex using the following yaml, the JSP fails to render with:
/WEB-INF/jsp/foo.jsp 404 not found
runtime: java
env: flex
runtime_config: # Optional
jdk: openjdk8
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 2
disk_size_gb: 10
My questions are:
- Can you help me understand why JSP works locally but not deployed on GAE? Is there any scope directive I am missing in the pom for the tomcat-embed-jasper dependency?
- Do I need to use Jetty runtime to compile and render JSPs? I would much rather use the standard spring boot embedded tomcat
- Do I need a web.xml with Tomcat? (I don't think that is the case)
- Does it matter selecting JAR vs. WAR as packaging?
Thanks in advance,
Daniel