Is it possible with Spring Boot to serve up JSPs with a JAR packaging?

As @Andy Wilkinson said, there are limitations related to JSP. Please package your application as war and execute as jar. This is documented at spring site.

With Tomcat it should work if you use war packaging, i.e. an executable war will work (…). An executable jar will not work because of a hard coded file pattern in Tomcat.


Deprecated, old answer

Yes, this is possible with Spring Boot.

Take look at this example: https://github.com/mariuszs/spring-boot-web-jsp-example.

For doing this use spring-boot-maven-plugin or gradle equivalent.

With this plugin jar is executable and can serve JSP files.

$ mvn package
$ java -jar target/mymodule-0.0.1-SNAPSHOT.war 

(Note the extension of the artifact in the above command .war)
or just

$ mvn spring-boot:run

Leave a Comment