I´m starting with Spring Boot for that I´m following a tutorial. In the tutorial, they created the controller with the #RequestMapping and GET method, once they have run the application, in the console is displayed something like this:
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/rooms], methods
= GET}" onto java.util.List<..//more lines
But in my case I got an error:
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto
public
org.springframework.http.ResponseEntity>
org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
Why the Mapping is not created?
This is the controller:
package com.frankmoley.london.data.webservice;
import com.frankmoley.london.data.entity.Room;
import com.frankmoley.london.data.repository.RoomRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
#RestController
public class RoomController {
#Autowired
private RoomRepository repository;
#RequestMapping(value="/rooms", method= RequestMethod.GET)
List<Room> findAll(#RequestParam(required=false) String roomNumber){
List<Room> rooms = new ArrayList<>();
if(null==roomNumber){
Iterable<Room> results = this.repository.findAll();
results.forEach(room-> {rooms.add(room);});
}else{
Room room = this.repository.findByNumber(roomNumber);
if(null!=room) {
rooms.add(room);
}
}
return rooms;
}
}
Entity:
package com.frankmoley.london.data.entity;
import javax.persistence.*;
#Entity
#Table(name = "ROOM")
public class Room {
#Id
#Column(name = "ROOM_ID")
#GeneratedValue(strategy = GenerationType.AUTO)
private long id;
#Column(name = "NAME")
private String name;
#Column(name = "ROOM_NUMBER")
private String number;
#Column(name = "BED_INFO")
private String info;
//getters and setters
}
Repository:
package com.frankmoley.london.data.repository;
import com.frankmoley.london.data.entity.Room;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
#Repository
public interface RoomRepository extends CrudRepository<Room, Long> {
Room findByNumber(String number);
}
Following are my logs:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.8.RELEASE)
2019-09-09 21:41:37.074 INFO 25569 --- [ main] SpringRest.spring_rest.Application : Starting Application on prashant-ubuntu with PID 25569 (/home/prashant/workspace/egen/spring-rest/target/spring-rest-1.0.0.jar started by prashant in /home/prashant/workspace/egen/spring-rest/target)
2019-09-09 21:41:37.077 INFO 25569 --- [ main] SpringRest.spring_rest.Application : No active profile set, falling back to default profiles: default
2019-09-09 21:41:37.715 INFO 25569 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-09-09 21:41:37.796 INFO 25569 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 68ms. Found 1 repository interfaces.
2019-09-09 21:41:38.389 INFO 25569 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d6eeeeff] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-09 21:41:38.696 INFO 25569 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-09-09 21:41:38.735 INFO 25569 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-09-09 21:41:38.735 INFO 25569 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.24]
2019-09-09 21:41:38.837 INFO 25569 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-09-09 21:41:38.837 INFO 25569 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1701 ms
2019-09-09 21:41:39.124 INFO 25569 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-09-09 21:41:39.415 INFO 25569 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-09-09 21:41:39.463 INFO 25569 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-09-09 21:41:39.525 INFO 25569 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
2019-09-09 21:41:39.526 INFO 25569 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-09-09 21:41:39.662 INFO 25569 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-09-09 21:41:39.866 INFO 25569 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2019-09-09 21:41:40.463 INFO 25569 --- [ main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
2019-09-09 21:41:40.559 INFO 25569 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-09-09 21:41:41.041 INFO 25569 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-09-09 21:41:41.114 WARN 25569 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2019-09-09 21:41:41.380 INFO 25569 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-09-09 21:41:41.382 INFO 25569 --- [ main] SpringRest.spring_rest.Application : Started Application in 4.703 seconds (JVM running for 5.103)
2019-09-09 21:42:03.922 INFO 25569 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-09-09 21:42:03.922 INFO 25569 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-09-09 21:42:03.934 INFO 25569 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 12 ms
Hibernate: select employee0_.id as id1_0_, employee0_.email as email2_0_, employee0_.name as name3_0_, employee0_.salary as salary4_0_ from employee employee0_
you can clearly see that there aren't any references of RequestMappingHandlerMapping
But still the service is hosted at "/".
I have used the following URL:
http://localhost:8080/employees/springEntityManagerJpa
With other spring application which is not spring boot, the URL is as follows:
http://localhost:8080/spring-rest/api/employees/springEntityManagerJpa
I assume your is the similar case. May be the service is up, but you are providing the wrong endpoints. Just remove the context path. In my case I removed /spring-rest/api
Hope this helps!!!
Related
I deployed my spring boot project with jar file on my lightsail server. I think it deployed fine however, I can't access it.
Chrome says,
This site can’t be reached {ip} refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
internal tomcat log
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.0)
2022-06-21 05:37:40.476 INFO 7028 --- [ main] com.--Application : Starting MyApplication using Java 17.0.3 on ip-172-26-7-171 with PID 7028 (/home/ubuntu/My.jar started by root in /home/ubuntu)
2022-06-21 05:37:40.483 INFO 7028 --- [ main] com.--Application : The following 1 profile is active: "prod"
2022-06-21 05:37:42.758 INFO 7028 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-06-21 05:37:42.883 INFO 7028 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 100 ms. Found 1 JPA repository interfaces.
2022-06-21 05:37:44.472 INFO 7028 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 80 (http)
2022-06-21 05:37:44.501 INFO 7028 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-06-21 05:37:44.502 INFO 7028 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.63]
2022-06-21 05:37:44.694 INFO 7028 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-06-21 05:37:44.695 INFO 7028 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3508 ms
2022-06-21 05:37:45.661 INFO 7028 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-06-21 05:37:46.006 INFO 7028 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-06-21 05:37:46.121 INFO 7028 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-06-21 05:37:46.275 INFO 7028 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.9.Final
2022-06-21 05:37:46.658 INFO 7028 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-06-21 05:37:46.910 INFO 7028 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL55Dialect
2022-06-21 05:37:48.039 INFO 7028 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-06-21 05:37:48.055 INFO 7028 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-06-21 05:37:48.995 WARN 7028 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-06-21 05:37:49.637 WARN 7028 --- [ main] org.thymeleaf.templatemode.TemplateMode : [THYMELEAF][main] Template Mode 'HTML5' is deprecated. Using Template Mode 'HTML' instead.
2022-06-21 05:37:50.173 INFO 7028 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter#3d1f558a, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#6abdec0e, org.springframework.security.web.context.SecurityContextPersistenceFilter#3762c4fc, org.springframework.security.web.header.HeaderWriterFilter#4b4ee511, org.springframework.security.web.csrf.CsrfFilter#38f77cd9, org.springframework.security.web.authentication.logout.LogoutFilter#2ae62bb6, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#5762658b, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#6ca372ef, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#28f4f300, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#6aa3bfc, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#59fbb34, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#1b6924cb, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#2b5c4f17, org.springframework.security.web.session.SessionManagementFilter#5a034157, org.springframework.security.web.access.ExceptionTranslationFilter#4483d35, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#6fc1020a]
2022-06-21 05:37:50.300 INFO 7028 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 80 (http) with context path ''
2022-06-21 05:37:50.332 INFO 7028 --- [ main] com.--Application : Started MyApplication in 10.965 seconds (JVM running for 12.248)
This is my firewall settings on lightsail.
/home/ubuntu# lsof -i -nP | grep LISTEN | awk '{print $(NF-1)" "$1}' | sort -u
*:22 sshd
127.0.0.1:33060 ssh
127.0.0.1:80 java
127.0.0.53:53 systemd-r
Do I have to edit firewall setting?
I remove server.address=localhost from application.properties and it works well.
I am now making Spring boot based Web project.
When using AWS EC2 ubuntu for deployment, unsolved error came out and I want to share.
Project stack: Spring boot + AWS (EC2, S3, RDS(MariaDB))
Deployment is run by ubuntu with Spring boot JAR file.
java -jar *.jar
The problem is whenever I start application by JAR file, the server immediately stops with this log. I thought it is because of WebSocketConfig.java for Chat messaging function, but even I added Threadpoooltaskschedule and STOMP setAllowedOrigins, symtoms still exists.
Exhausted with solving by own, I need some help from you guys.
WebSocketConfig.java
private static final Logger LOGGER = LoggerFactory.getLogger(WebsocketBrokerConfig.class);
#Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
//for subscribe prefix
registry.enableSimpleBroker("/user");
//for publish prefix
registry.setApplicationDestinationPrefixes("/app");
//user destination provides ability to have unique user queue
//registry.setUserDestinationPrefix("/user");
}
#Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/broadcast")
.setAllowedOrigins("http://ec2....amazonaws.com")
.withSockJS()
.setHeartbeatTime(60_000);
}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.3)
2021-03-03 00:44:34.278 INFO 5898 --- [ main] com.example.salle.SalleApplication : Starting SalleApplication v0.0.1-SNAPSHOT using Java 1.8.0_282 on ip-172-31-46-33 with PID 5898 (/home/ubuntu/salle/salle/target/test-0.0.1-SNAPSHOT.jar started by ubuntu in /home/ubuntu/salle/salle)
2021-03-03 00:44:34.283 INFO 5898 --- [ main] com.example.salle.SalleApplication : No active profile set, falling back to default profiles: default
2021-03-03 00:44:36.435 INFO 5898 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-03-03 00:44:36.489 INFO 5898 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 31 ms. Found 0 JPA repository interfaces.
2021-03-03 00:44:38.298 INFO 5898 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-03-03 00:44:38.330 INFO 5898 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-03-03 00:44:38.330 INFO 5898 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.43]
2021-03-03 00:44:39.363 INFO 5898 --- [ main] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2021-03-03 00:44:39.969 INFO 5898 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-03-03 00:44:39.969 INFO 5898 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5536 ms
2021-03-03 00:44:41.016 INFO 5898 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-03-03 00:44:41.247 INFO 5898 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-03-03 00:44:41.408 INFO 5898 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-03-03 00:44:41.600 INFO 5898 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.28.Final
2021-03-03 00:44:41.900 INFO 5898 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-03-03 00:44:42.217 INFO 5898 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MariaDB103Dialect
2021-03-03 00:44:43.125 INFO 5898 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
ct.MariaDB103Dialect
2021-03-03 00:44:43.155 INFO 5898 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-03-03 00:44:45.786 INFO 5898 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService
2021-03-03 00:44:45.860 INFO 5898 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'messageBrokerTaskScheduler'
2021-03-03 00:44:46.023 INFO 5898 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'clientInboundChannelExecutor'
2021-03-03 00:44:46.025 INFO 5898 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'clientOutboundChannelExecutor'
2021-03-03 00:44:46.035 INFO 5898 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'brokerChannelExecutor'
2021-03-03 00:44:46.140 WARN 5898 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-03-03 00:44:47.221 INFO 5898 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-03-03 00:44:47.227 INFO 5898 --- [ main] o.s.m.s.b.SimpleBrokerMessageHandler : Starting...
2021-03-03 00:44:47.227 INFO 5898 --- [ main] o.s.m.s.b.SimpleBrokerMessageHandler : BrokerAvailabilityEvent[available=true, SimpleBrokerMessageHandler [DefaultSubscriptionRegistry[cache[0 destination(s)], registry[0 sessions]]]]
2021-03-03 00:44:47.233 INFO 5898 --- [ main] o.s.m.s.b.SimpleBrokerMessageHandler : Started.
2021-03-03 00:44:47.252 INFO 5898 --- [ main] com.example.salle.SalleApplication : Started SalleApplication in 14.288 seconds (JVM running for 15.469)
2021-03-03 00:45:00.256 INFO 5898 --- [extShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : Stopping...
2021-03-03 00:45:00.258 INFO 5898 --- [extShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : BrokerAvailabilityEvent[available=false, SimpleBrokerMessageHandler [DefaultSubscriptionRegistry[cache[0 destination(s)], registry[0 sessions]]]]
2021-03-03 00:45:00.258 INFO 5898 --- [extShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : Stopped.
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'brokerChannelExecutor'
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'clientOutboundChannelExecutor'
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'clientInboundChannelExecutor'
2021-03-03 00:45:00.284 INFO 5898 --- [extShutdownHook] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'messageBrokerTaskScheduler'
2021-03-03 00:45:00.296 INFO 5898 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-03-03 00:45:00.299 INFO 5898 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...```
The easiest way to put a Spring BOOT app on an EC2 instance is to use Elastic Beanstalk. Read this AWS doc for more details - https://aws.amazon.com/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/
My Spring Boot Application connects to a PostgreSQL database but it didn't create the tables which i have implemented as entities. That's why I set up the tables by myself with test data.
When I use dataRepository.findAll() to access the data, it returns an empty list.
So as far as I understood, I think it connects to my database, because I get no errors, but it looks like the schemas don't work properly.
I'm pretty sure this is a "configuration" problem, but I was not able to figure out what it is.
PS: I have another project with quite the same settings and code(just another database on the same server) which works perfectly fine.
My gradle.build file:
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
group = 'de.dari'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '8'
repositories {
mavenCentral()
maven { url "http://htmlunit.sourceforge.net" }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
//implementation 'org.springframework.boot:spring-boot-starter-data-rest'
compile("net.sourceforge.htmlunit:htmlunit:2.35.0")
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
My application.properties file:
spring.datasource.url=jdbc:postgresql://webaddress.com:5432/b-one
spring.datasource.username=username
spring.datasource.password=secretPassword
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
An Example Entity:
#Entity
public class Data {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
#NotNull
private String value;
/*
* Blank Constructor + Getters and Setters down here
*/
}
Simple CRUD-Repository:
public interface DataRepository extends CrudRepository<Data, Long> {
}
Controller:
#Autowired
DataRepository dataRepository;
#GetMapping("/test")
public String test() {
return dataRepository.findAll().toString();
}
Yeah so I don't get any error messages and the logs weren't helpful for me but maybe you want to get a glimpse on them.
Console-Output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
2019-08-26 16:23:53.225 INFO 10220 --- [ main] de.dari.bone.REST.Application : Starting Application on GamingPC with PID 10220 (started by Deniz Cuhadari in C:\Users\Deniz Cuhadari\OneDrive - inc\Projects\b-one\b-one.REST)
2019-08-26 16:23:53.230 INFO 10220 --- [ main] de.dari.bone.REST.Application : No active profile set, falling back to default profiles: default
2019-08-26 16:23:54.083 INFO 10220 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-08-26 16:23:54.202 INFO 10220 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 110ms. Found 6 repository interfaces.
2019-08-26 16:23:54.568 INFO 10220 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$24d7df9e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-08-26 16:23:54.878 INFO 10220 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-08-26 16:23:54.907 INFO 10220 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-08-26 16:23:54.908 INFO 10220 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-08-26 16:23:55.057 INFO 10220 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-08-26 16:23:55.057 INFO 10220 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1757 ms
2019-08-26 16:23:55.226 INFO 10220 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-08-26 16:23:55.650 INFO 10220 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-08-26 16:23:55.711 INFO 10220 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-08-26 16:23:55.793 INFO 10220 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.10.Final}
2019-08-26 16:23:55.795 INFO 10220 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-08-26 16:23:55.947 INFO 10220 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-08-26 16:23:56.098 INFO 10220 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2019-08-26 16:24:02.271 INFO 10220 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000421: Disabling contextual LOB creation as hibernate.jdbc.lob.non_contextual_creation is true
2019-08-26 16:24:02.278 INFO 10220 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#7e49ded
2019-08-26 16:24:03.329 INFO 10220 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-08-26 16:24:03.946 INFO 10220 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-08-26 16:24:03.987 WARN 10220 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2019-08-26 16:24:04.051 INFO 10220 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2019-08-26 16:24:04.162 INFO 10220 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-08-26 16:24:04.165 INFO 10220 --- [ main] de.dari.bone.REST.Application : Started Application in 11.503 seconds (JVM running for 12.75)
2019-08-26 16:24:09.762 INFO 10220 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-08-26 16:24:09.762 INFO 10220 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-08-26 16:24:09.769 INFO 10220 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 7 ms
2019-08-26 16:24:09.905 INFO 10220 --- [nio-8080-exec-1] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
Spring boot issues with following code. see error below and tomcat is running fine
package com.template;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SpringBootFreemarkerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootFreemarkerApplication.class,
args);
}
}
package controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
#Controller
public class TestController {
#RequestMapping("/welcome")
public String hello(Model model, #RequestParam(value="name",
required=false, defaultValue="World") String name) {
model.addAttribute("name", name);
return "welcome";
}
}
"C:\Program Files\Java\jdk1.8.0_121\bin\java" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.1.5\lib\idea_rt.jar=54267:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.1.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_121\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\rt.jar;C:\SpringBoot\Spring-boot-freemarker\target\classes;C:\Users\shekhar\.m2\repository\org\springframework\boot\spring-boot-starter-freemarker\1.5.6.RELEASE\spring-boot-starter-freemarker-1.5.6.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\boot\spring-boot-starter\1.5.6.RELEASE\spring-boot-starter-1.5.6.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\boot\spring-boot\1.5.6.RELEASE\spring-boot-1.5.6.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.6.RELEASE\spring-boot-autoconfigure-1.5.6.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.5.6.RELEASE\spring-boot-starter-logging-1.5.6.RELEASE.jar;C:\Users\shekhar\.m2\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\shekhar\.m2\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\shekhar\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\shekhar\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\shekhar\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;C:\Users\shekhar\.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\shekhar\.m2\repository\org\freemarker\freemarker\2.3.26-incubating\freemarker-2.3.26-incubating.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-context-support\4.3.10.RELEASE\spring-context-support-4.3.10.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-beans\4.3.10.RELEASE\spring-beans-4.3.10.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-context\4.3.10.RELEASE\spring-context-4.3.10.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\boot\spring-boot-starter-web\1.5.6.RELEASE\spring-boot-starter-web-1.5.6.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.6.RELEASE\spring-boot-starter-tomcat-1.5.6.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.16\tomcat-embed-core-8.5.16.jar;C:\Users\shekhar\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.16\tomcat-embed-el-8.5.16.jar;C:\Users\shekhar\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.16\tomcat-embed-websocket-8.5.16.jar;C:\Users\shekhar\.m2\repository\org\hibernate\hibernate-validator\5.3.5.Final\hibernate-validator-5.3.5.Final.jar;C:\Users\shekhar\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\shekhar\.m2\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;C:\Users\shekhar\.m2\repository\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar;C:\Users\shekhar\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.9\jackson-databind-2.8.9.jar;C:\Users\shekhar\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\shekhar\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.9\jackson-core-2.8.9.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-web\4.3.10.RELEASE\spring-web-4.3.10.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-aop\4.3.10.RELEASE\spring-aop-4.3.10.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-webmvc\4.3.10.RELEASE\spring-webmvc-4.3.10.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-expression\4.3.10.RELEASE\spring-expression-4.3.10.RELEASE.jar;C:\Users\shekhar\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\shekhar\.m2\repository\org\springframework\spring-core\4.3.10.RELEASE\spring-core-4.3.10.RELEASE.jar" com.template.SpringBootFreemarkerApplication
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.6.RELEASE)
2017-07-30 15:20:08.005 INFO 7612 --- [ main] c.t.SpringBootFreemarkerApplication : Starting SpringBootFreemarkerApplication on DESKTOP-9LIAED5 with PID 7612 (C:\SpringBoot\Spring-boot-freemarker\target\classes started by shekhar in C:\SpringBoot\Spring-boot-freemarker)
2017-07-30 15:20:08.008 INFO 7612 --- [ main] c.t.SpringBootFreemarkerApplication : No active profile set, falling back to default profiles: default
2017-07-30 15:20:08.074 INFO 7612 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3bd94634: startup date [Sun Jul 30 15:20:08 IST 2017]; root of context hierarchy
2017-07-30 15:20:10.322 INFO 7612 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-07-30 15:20:10.333 INFO 7612 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-07-30 15:20:10.334 INFO 7612 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.16
2017-07-30 15:20:10.472 INFO 7612 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-07-30 15:20:10.472 INFO 7612 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2398 ms
2017-07-30 15:20:10.788 INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-07-30 15:20:10.792 INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-07-30 15:20:10.792 INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-07-30 15:20:10.793 INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-07-30 15:20:10.793 INFO 7612 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-07-30 15:20:11.221 INFO 7612 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3bd94634: startup date [Sun Jul 30 15:20:08 IST 2017]; root of context hierarchy
2017-07-30 15:20:11.299 INFO 7612 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/welcome]}" onto public java.lang.String com.template.controller.TestController.hello(org.springframework.ui.Model,java.lang.String)
2017-07-30 15:20:11.302 INFO 7612 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-07-30 15:20:11.302 INFO 7612 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-07-30 15:20:11.337 INFO 7612 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-30 15:20:11.337 INFO 7612 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-30 15:20:11.374 INFO 7612 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-30 15:20:11.626 INFO 7612 --- [ main] o.s.w.s.v.f.FreeMarkerConfigurer : ClassTemplateLoader for Spring macros added to FreeMarker configuration
2017-07-30 15:20:11.727 INFO 7612 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-07-30 15:20:11.790 INFO 7612 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-07-30 15:20:11.795 INFO 7612 --- [ main] c.t.SpringBootFreemarkerApplication : Started SpringBootFreemarkerApplication in 4.222 seconds (JVM running for 5.046)
Your controller is not scanned by the default component scan that Spring Boot provides. By default Spring boot starts from the package that contains the "main" class - the one annotated with #SpringBootApplication and also scans all of it's sub packages.
Your main class is in package com.template; but the controller is in package controller;. Move the controller in a package named package com.template.controller;
Since you are using FreeMarker Template with spring boot, I would suggest you to move your welcome.ftl template from this location src/webapp/welcome.ftl to this src/main/resources/templates/welcome.ftl and then restart your application and hit http://localhost:8080/welcome
i have a strange problem when i launch my spring application it used to print a default password to login in the browser but now ther isn't :
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2017-06-26 17:04:32.024 INFO 28712 --- [ main] com.o2xp.ats.accountManager.App : Starting App on frozzen-PC with PID 28712 (/home/frozzen/workspace/ATS/ats-parent/ats-impl/ats-accountManager/target/classes started by frozzen in /home/frozzen/workspace/ATS/ats-parent/ats-impl/ats-accountManager)
2017-06-26 17:04:32.030 INFO 28712 --- [ main] com.o2xp.ats.accountManager.App : No active profile set, falling back to default profiles: default
2017-06-26 17:04:32.282 INFO 28712 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#45f45fa1: startup date [Mon Jun 26 17:04:32 CEST 2017]; root of context hierarchy
2017-06-26 17:04:35.685 INFO 28712 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-06-26 17:04:35.723 INFO 28712 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-06-26 17:04:35.724 INFO 28712 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.14
2017-06-26 17:04:35.962 INFO 28712 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-06-26 17:04:35.962 INFO 28712 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3688 ms
2017-06-26 17:04:36.361 INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-06-26 17:04:36.362 INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-06-26 17:04:36.362 INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-06-26 17:04:36.362 INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-06-26 17:04:36.364 INFO 28712 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-06-26 17:04:36.365 INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-06-26 17:04:37.170 INFO 28712 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-06-26 17:04:37.195 INFO 28712 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-06-26 17:04:37.300 INFO 28712 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2017-06-26 17:04:37.302 INFO 28712 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2017-06-26 17:04:37.305 INFO 28712 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-06-26 17:04:37.373 INFO 28712 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-06-26 17:04:37.741 INFO 28712 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2017-06-26 17:04:38.642 INFO 28712 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2017-06-26 17:04:38.721 INFO 28712 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2017-06-26 17:04:38.767 INFO 28712 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-06-26 17:04:39.857 INFO 28712 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#ff0e6d4, org.springframework.security.web.context.SecurityContextPersistenceFilter#1a785fd5, org.springframework.security.web.header.HeaderWriterFilter#1d1bf7bf, org.springframework.security.web.csrf.CsrfFilter#748904e8, org.springframework.security.web.authentication.logout.LogoutFilter#650a1aff, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#10bf1ec9, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#8f39224, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#7606bd03, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#362a561e, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#ad0bb4e, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#70d3cdbf, org.springframework.security.web.session.SessionManagementFilter#4d43a1b7, org.springframework.security.web.access.ExceptionTranslationFilter#919086, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#6b3f4bd8]
2017-06-26 17:04:40.221 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#45f45fa1: startup date [Mon Jun 26 17:04:32 CEST 2017]; root of context hierarchy
2017-06-26 17:04:40.323 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/registration],methods=[POST]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.registration(com.o2xp.ats.accountManager.to.ApplicantTO,org.springframework.validation.BindingResult,org.springframework.ui.Model)
2017-06-26 17:04:40.324 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/registration],methods=[GET]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.registration(org.springframework.ui.Model)
2017-06-26 17:04:40.325 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories],methods=[GET]}" onto public java.util.List<com.o2xp.ats.accountManager.to.ApplicantTO> com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.getAllApplicants()
2017-06-26 17:04:40.326 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{id}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<com.o2xp.ats.accountManager.ti.ApplicantTI> com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.getApplicantById(java.lang.Long)
2017-06-26 17:04:40.326 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/login],methods=[GET]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.login(org.springframework.ui.Model,java.lang.String,java.lang.String)
2017-06-26 17:04:40.327 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/ || /welcome],methods=[GET]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.welcome(org.springframework.ui.Model)
2017-06-26 17:04:40.327 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{id}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<java.lang.Void> com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.deleteApplicant(java.lang.Long)
2017-06-26 17:04:40.333 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-06-26 17:04:40.334 INFO 28712 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-06-26 17:04:40.380 INFO 28712 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-26 17:04:40.380 INFO 28712 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-26 17:04:40.445 INFO 28712 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-26 17:04:40.821 INFO 28712 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-06-26 17:04:40.894 INFO 28712 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-06-26 17:04:40.901 INFO 28712 --- [ main] com.o2xp.ats.accountManager.App : Started App in 9.52 seconds (JVM running for 10.076)
and here is my App :
package com.o2xp.ats.accountManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
/**
* Hello world!
*
*/
#SpringBootApplication
#ComponentScan({ "com.o2xp.ats.common.domain", "com.o2xp.ats.common.services", "com.o2xp.ats.common.mapper",
"com.o2xp.ats.accountManager.services", "com.o2xp.ats.accountManager.mapper",
"com.o2xp.ats.accountManager.domain", "com.o2xp.ats.accountManager.rest.controllers",
"com.o2xp.ats.accountManager.validator" })
#EnableJpaRepositories({ "com.o2xp.ats.common.repository", "com.o2xp.ats.accountManager.repository" })
#EntityScan({ "com.o2xp.ats.common.domain", "com.o2xp.ats.accountManager.domain" })
#EnableWebSecurity
public class App extends org.springframework.boot.web.support.SpringBootServletInitializer {
private static final Logger log = LoggerFactory.getLogger(App.class);
public static void main(String[] args) {
SpringApplication.run(App.class);
}
i've seen
If you fine-tune your logging configuration, ensure that the
org.springframework.boot.autoconfigure.security category is set to log
INFO messages, otherwise the default password will not be printed.
into the spring doc but don't know where is the file to modify.
Set logging level at application.properties. Take a look 26.4 Log Levels
logging.level.org.springframework.boot.autoconfigure.security=INFO
You need to add the key and logging level to application.properties.
Have a look here