M
M
Maxim Isaev2021-07-13 10:56:52
Java
Maxim Isaev, 2021-07-13 10:56:52

How to fix error in spring page rendering?

Good day to all.

I am getting this error

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Jul 13 11:50:39 GMT+04:00 2021
There was an unexpected error (type=Not Found, status=404).
No message available

controller

package org.purposetracking.controller;

import org.purposetracking.model.User;
import org.purposetracking.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class UserController {

@Autowired
private UserService userService;

@GetMapping("/users")
public String showUsers(Model model) {
Iterable users = userService.getAll();
model.addAttribute("users", users);
return "index";
}
}

application.properties

# ===============================
# = DATA SOURCE
# ===============================
# Set here configurations for the database connection
spring.datasource.url=jdbc:postgresql://localhost:5432/purposes-tracking
spring.datasource.username=postgres
spring.datasource.password=12332112
spring.datasource.driver-class-name=org.postgresql.Driver
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
# ===============================
# = JPA / HIBERNATE
# ===============================
# Show or not log for each sql query
spring.jpa.show-sql=true
# Hibernate ddl auto (create, create-drop, update): with "create-drop" the database
# schema will be automatically created afresh for every start of application
#spring.jpa.hibernate.ddl-auto=create-drop

# Naming strategy
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy

# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect


Tell me, please, where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-07-13
@MaximIs

If the question is to see a clear error instead of Whitelabel, then dig towards the error handler. If the question is that the error does not occur at all, then dig logs to find its causes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question