I am new in Spring boot and I think this issue is very basic.
I created an application using Spring Boot and everything is good in dev environment. But when I copy the jar file from target directory to another machine and run "java -jar" it doesn't render jsp pages with following error:
There was an unexpected error (type=Not Found, status=404)
when I copy src folder from project root to same location it works fine.
It seems the jar file just work from project's root.
Here is my configurations:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Spring Boot Section -->
<!-- Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<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>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/webapp</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
and my project structure:
and I run following at command line:
mvn clean package
I have following in my target directory:
I can run the application using
java -jar target/springboot-in-10-steps-0.0.1.jar
Application works as expected and it renders welcome page.
When I go to target directory and run same command:
java -jar springboot-in-10-steps-0.0.1.jar
Application gets launch but it doesn't render the welcome page.
When I copy src to target everything is fine and I can see welcome page. It seems Spring boot doesn't find WEB-INF/jsp directory in the jar file.
Did I miss something in spring boot configuration or application.properties?

