HTTP Status 404 – Not Found for Spring Security SAML2 Sample app - java

Getting this error when I try to configure the Spring Security SAML2 Sample app.
HTTP Status 404 – Not Found Type Status Report
Message The requested resource [/spring-security-saml2-sample] is not
available
Description The origin server did not find a current representation
for the target resource or is not willing to disclose that one exists.
Apache Tomcat/10.0.8
I can access Tomcat on this page fine - http://localhost:8080/, just cannot access the spring-security-saml2-sample page - http://localhost:8080/spring-security-saml2-sample
Following this guide:
https://developer.okta.com/code/java/spring_security_saml/
https://docs.spring.io/spring-security-saml/docs/current/reference/html/chapter-quick-start.html
pom.xml file details:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<!-- Tomcat embedded container-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml-dsl</artifactId>
<version>1.0.0.M3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
</repository>
</repositories>
</project>

Related

The eureka server interface is not displayed correctly on the external tomcat server

I tried to deploy my Eureka Server on Tomcat v10.1.5, but the interface is not showed properly (wro.css and wro.js not found)
POM.XML
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com</groupId>
<artifactId>discoveryserver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>discoveryserver</name>
<packaging>war</packaging>
<properties>
<java.version>17</java.version>
<spring-cloud.version>2022.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>netflix-candidates</id>
<name>Netflix Candidates</name>
<url>https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
It worked properly with Tomcat v9.0, Spring 2.4.1 and Java 1.8, but I need to deploy it on Tomcat v10.1.5 and use Java 17
Has anyone else encountered this problem?

package org.springframework.boot does not exist error for multimodule project

This is pom.xml of child project, aragorn-web is parent:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.caner</groupId>
<artifactId>aragorn-web</artifactId>
<version>1.0</version>
</parent>
<artifactId>aragorn-internal</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
<version>3.0.11.RELEASE</version>
</dependency>
</dependencies>
</project>
This is the java class to run
package com.caner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class AragornInternalApplication{
public static void main(String[] args) {
SpringApplication.run(AragornInternalApplication.class, args);
}
}
When I run that child module, it gives error:
Connected to the target VM, address: '127.0.0.1:58367', transport: 'socket'
Error: Could not find or load main class com.caner.AragornInternalApplication
Disconnected from the target VM, address: '127.0.0.1:58367', transport: 'socket'
Process finished with exit code 1
When i go to problems tab at intellij, I see lots of errors for almost all classes. But for AragornInternalApplication.java:
Error:(3, 32) java: package org.springframework.boot does not exist
Error:(4, 46) java: package org.springframework.boot.autoconfigure does not exist
Error:(6, 2) java: cannot find symbol
symbol: class SpringBootApplication
Error:(10, 9) java: cannot find symbol
symbol: variable SpringApplication
location: class com.caner.AragornInternalApplication
BUt I have spring-boot
<artifactId>spring-boot-starter-web</artifactId>
Main pom xml is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<!--2.1.4.RELEASE-->
<!--2.1.3.RELEASE-->
<!--2.1.2.RELEASE-->
<relativePath/>
</parent>
<groupId>com.caner</groupId>
<artifactId>aragorn-web</artifactId>
<version>1.0</version>
<name>aragorn-web</name>
<packaging>pom</packaging>
<modules>
<module>aragorn-backend</module>
<module>aragorn-external</module>
<module>aragorn-internal</module>
</modules>
</project>
I copied pom from other child pom but it does not work.
When i go to modules section at Intellij, i can see all options like path, resources are same with that child.
This is other child pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.caner</groupId>
<artifactId>aragorn-web</artifactId>
<version>1.0</version>
</parent>
<artifactId>aragorn-external</artifactId>
<version>1.0</version>
<name>aragorn-external</name>
<!-- <description>caner E-book (Project:aragorn)</description>-->
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
<hibernate-core.version>5.3.7.Final</hibernate-core.version>
<hibernate-commons-annotations.version>5.0.4.Final</hibernate-commons-annotations.version>
<commons-codec.version>1.9</commons-codec.version>
<mysql-connector-java.version>5.1.46</mysql-connector-java.version>
<joda-time.version>2.9.9</joda-time.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
<dependency>
<groupId>com.caner</groupId>
<artifactId>aragorn-backend</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>hibernate-validator</id>
<url>https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator</url>
</repository>
<repository>
<id>hibernate-core</id>
<url>https://mvnrepository.com/artifact/org.hibernate/hibernate-core</url>
</repository>
<repository>
<id>hibernate-commons-annotations</id>
<url>https://mvnrepository.com/artifact/org.hibernate.common/hibernate-commons-annotations</url>
</repository>
<repository>
<id>reflections</id>
<url>https://mvnrepository.com/artifact/org.reflections/reflections</url>
</repository>
<!--<repository>-->
<!--<id>joda</id>-->
<!--<url>https://mvnrepository.com/artifact/joda-time/joda-time</url>-->
<!--</repository>-->
<repository>
<id>apache commons-codec</id>
<url>https://mvnrepository.com/artifact/commons-codec/commons-codec</url>
</repository>
</repositories>
<build>
<finalName>ROOT</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<junitArtifactName>junit:junit</junitArtifactName>
<argLine>
<!-- -Dspring.profiles.active=dev-->
-Xms256m -Xmx512m -ea -Dfile.encoding=UTF-8
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
I restarted, invalidated cache, removed all dependencies, added other dependencies but could not make it work.
I also tried to convert to jar but still same
<packaging>jar</packaging>
Please help
If your parent is not the spring-boot-starter-parent pom you have to add dependency management to your parent pom:
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Read more in the official documentation: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-maven-without-a-parent

Application startup error while deploying java spring-boot app to GCP app engine

While deploying to GCP my build is successful but I am facing Application Startup Error. The app is running fine at localhost.
The error says: Application startup error.
My pom.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.sample</groupId>
<artifactId>catapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>catapi</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
<version>42.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My application.properties is:
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.show-sql=true
spring.cloud.gcp.projectId=swathitest1
spring.cloud.gcp.sql.instanceName=swathi-db
spring.cloud.gcp.sql.databaseName=test
spring.cloud.gcp.sql.userName=postgres
spring.cloud.gcp.sql.password=Welcome1!
spring.cloud.gcp.sql.jdbcDriver=org.postgresql.Driver
spring.cloud.gcp.sql.jdbcUrl=jdbc:postgresql://google/test?socketFactory=com.google.cloud.sql.postgres.SocketFactory&socketFactoryArg=swathitest1:asia-south1:swathi-db
spring.datasource.url=jdbc:postgresql://35.200.222.222:5432/test
spring.datasource.username=postgres
spring.datasource.password=Welcome1!
spring.datasource.initialization-mode=always
spring.datasource.initialize=true
spring.datasource.schema=classpath:/schema.sql
spring.datasource.continue-on-error=true
Do I need to add any other dependencies to pom.xml? or any changes required in my application.properties? Please guide me.
The full error stack trace is:
error_log

java.lang.ClassNotFoundException: com.netflix.discovery.EurekaClientConfig

I'm using Spring Cloud Eureka and creating the project using Spring Initializr (http://start.spring.io/). The generated POM user Eureka Finchley.RC2 with Spring Boot 2.0.2.RELEASE. When I add the annotation #EnableEurekaServer in the main class, the one annotated with #SpringBootApplication also, and I start the server with following command:
mvn spring-boot:run
I receive the exception
java.lang.ClassNotFoundException: com.netflix.discovery.EurekaClientConfig
the following is the pom.xml generated by the Initializr:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.javaboss</groupId>
<artifactId>api-gateway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>api-gateway</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.RC2</spring-cloud.version>
</properties>
<dependencies>
<!-- <dependency> -->
<!-- <groupId>org.springframework.cloud</groupId> -->
<!-- <artifactId>spring-cloud-starter-config</artifactId> -->
<!-- </dependency> -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
I found the eureka-clien-1.9.2.jar in my local maven repository is ZERO length file, so I deleted it and re-download the dependency, all is ok!
hope to help someone - i had same issue java.lang.NoClassDefFoundError:com/netflix/discovery/converters/XmlXStream when launch eureka server, version i used springboot 2.0.3.RELEASE and spring-cloud.version Finchley.RELEASE. i resolved it by rename my local maven repo user-folder.m2\repository, fresh load a new local maven repo.
Try to use below dependencies in your pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<finalName>eureka-server</finalName>
</build>
As 'rosa lu' said, when launch eureka server I have the similar issue as below:
java.lang.NoClassDefFoundError:com/netflix/discovery/converters/XmlXStream
SpringBoot=2.0.5.RELEASE
SpringCloud.version=Finchley.SR1
As 'rosa lu' said, I change my local maven repository to a new path, and rebuild my project, then solve the problem
I hope my answer can help anyone who has the same issue .
Make sure that
You should select only Eureka Server using spring Initializr
while creating eureka server project.
Have these properties (in application.properties)
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
These will disable the client aspect the the eureka server.
You might be having com.netflix.discovery.EurekaClientConfig imported somewhere in your project. So organize your imports once.
I finally solved the propblem in two different solution:
1.adding two more dependencies:
<dependency>
<groupId>com.netflix.eureka</groupId>
<artifactId>eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.3.5</version>
</dependency>
2.renaming application.yml in bootstrap.yml and disabling autoregistration:
eureka:
client:
registerWithEureka: false
fetchRegistry: false
but in this second way I still need to add the dependency to jettison:
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.3.5</version>
</dependency>

Exact Location to keep JSP files in a spring Boot App

I am new to spring boot and I have created a simple app using spring boot but I am not sure where I should keep my views(JSP's and HTML). I tried keeping it in src/main/webapp/WEB-INF/jsp/ folder but somehow its not rendering my views neither I am getting any error message. I have tried both jar and war packaging types. I have also put
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
in application.properties file.
My pom.xml file is as follows:-
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.spring.boot</groupId>
<artifactId>rest-api-database-new</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>rest-api-database-new</name>
<description>Rest Api connecting to database</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.12.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Categories

Resources