Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot JSP not found

in my Spring Boot app I switched from Thymeleaf to JSP and it is working normally on my local computer, but when I upload it to Heroku server I get
There was an unexpected error (type=Not Found, status=404). /WEB-INF/jsp/home.jsp

its jar packaged, what does it mean if its working locally but not on Heroku server?

edit, project structure enter image description here

like image 925
Weras Adve Avatar asked Dec 18 '22 04:12

Weras Adve


1 Answers

Try adding this to pom.xml:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>

and adding this to application.properties:

spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

and moving JSPs to src/main/webapp/WEB-INF/jsp.

like image 91
Kohei TAMURA Avatar answered Jan 07 '23 11:01

Kohei TAMURA