When I'm using HikariCP 2.4.7 I typically initialize it like this:
hikariDataSource = new HikariDataSource();
hikariDataSource.setDriverClassName("org.postgresql.Driver");
hikariDataSource.setUsername(DATABASE_USER_NAME);
hikariDataSource.setPassword(DATABASE_PASSWORD);
hikariDataSource.setJdbcUrl(DATABASE_URL);
And when I need a connection:
try(java.sql.Connection conn = hikariDataSource.getConnection()) {
Record1 record1 = DSL.using(conn).select(SENSOR.ID)
.from(SENSOR)
.where(SENSOR.ID.equal(1))
.limit(1)
.fetchOne();
System.out.println(record1.getValue(0).toString());
} catch (SQLException e) {
e.printStackTrace();
}
Should I do something in another way or add something when using HikariCP with Spring Boot 1.4.0?
Update 1:
build.gradle
compile("org.springframework.boot:spring-boot-starter-web:1.4.0.RELEASE")
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.4.0.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: '1.4.0.RELEASE'
compile group: 'com.zaxxer', name: 'HikariCP', version: '2.4.7'
application.properties
server.port=80
spring.datasource.hikari.jdbc-url=jdbc:postgresql://someaddress.com:5432/mydb
spring.datasource.hikari.username=myservice_backend
spring.datasource.hikari.password=mypass
spring.datasource.hikari.driver-class-name=org.postgresql.Driver
However, after adding spring-boot-starter-data-jpa and spring-boot-starter-jdbc and configuration in application.properties I get:
Connected to the target VM, address: '127.0.0.1:53695', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.0.RELEASE)
2016-08-03 16:09:34.033 INFO 3492 --- [ main] pl.mypackage.Main : Starting Main on Defozo-laptop with PID 3492 (C:\Users\Defozo\IdeaProjects\myProject\build\classes\main started by Defozo in C:\Users\Defozo\IdeaProjects\myProject)
2016-08-03 16:09:34.038 INFO 3492 --- [ main] pl.mypackage.Main : No active profile set, falling back to default profiles: default
2016-08-03 16:09:34.091 INFO 3492 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#f58853c: startup date [Wed Aug 03 16:09:34 CEST 2016]; root of context hierarchy
2016-08-03 16:09:35.298 INFO 3492 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'dataSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]]
2016-08-03 16:09:35.820 INFO 3492 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b802c57c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-08-03 16:09:36.484 INFO 3492 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 80 (http)
2016-08-03 16:09:36.501 INFO 3492 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-08-03 16:09:36.503 INFO 3492 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.4
2016-08-03 16:09:36.635 INFO 3492 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-08-03 16:09:36.635 INFO 3492 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2544 ms
2016-08-03 16:09:36.811 INFO 3492 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-08-03 16:09:36.814 INFO 3492 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-08-03 16:09:36.815 INFO 3492 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-08-03 16:09:36.815 INFO 3492 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-08-03 16:09:36.815 INFO 3492 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-08-03 16:09:36.863 WARN 3492 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2016-08-03 16:09:36.874 INFO 3492 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2016-08-03 16:09:36.888 INFO 3492 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report enable debug logging (start with --debug)
2016-08-03 16:09:36.896 ERROR 3492 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Disconnected from the target VM, address: '127.0.0.1:53695', transport: 'socket'
Process finished with exit code 1
I've tried to change this:
#SpringBootApplication
#EnableAutoConfiguration
public class Main extends SpringBootServletInitializer {
to this:
#SpringBootApplication
#EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class Main extends SpringBootServletInitializer {
But still I'm getting the same output.
Update 2:
application.properties
server.port=80
spring.datasource.url=jdbc:postgresql://someaddress.com:5432/mydb
spring.datasource.username=myservice_backend
spring.datasource.password=mypass
spring.datasource.driver-class-name=org.postgresql.Driver
Console output:
Connected to the target VM, address: '127.0.0.1:50640', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.0.RELEASE)
2016-08-04 12:55:49.369 INFO 11728 --- [ main] pl.mypackage.Main : Starting Main on Defozo-laptop with PID 11728 (C:\Users\Defozo\IdeaProjects\AirlyMap3\build\classes\main started by Defozo in C:\Users\Defozo\IdeaProjects\AirlyMap3)
2016-08-04 12:55:49.369 INFO 11728 --- [ main] pl.mypackage.Main : No active profile set, falling back to default profiles: default
2016-08-04 12:55:49.432 INFO 11728 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#f58853c: startup date [Thu Aug 04 12:55:49 CEST 2016]; root of context hierarchy
2016-08-04 12:55:50.786 INFO 11728 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'dataSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]]
2016-08-04 12:55:51.304 INFO 11728 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$932c4431] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-08-04 12:55:51.951 INFO 11728 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 80 (http)
2016-08-04 12:55:51.967 INFO 11728 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-08-04 12:55:51.969 INFO 11728 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.4
2016-08-04 12:55:52.114 INFO 11728 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-08-04 12:55:52.114 INFO 11728 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2682 ms
2016-08-04 12:55:52.315 INFO 11728 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-08-04 12:55:52.317 INFO 11728 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-08-04 12:55:52.317 INFO 11728 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-08-04 12:55:52.317 INFO 11728 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-08-04 12:55:52.317 INFO 11728 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-08-04 12:55:55.402 INFO 11728 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-08-04 12:55:55.418 INFO 11728 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-08-04 12:55:55.511 INFO 11728 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.9.Final}
2016-08-04 12:55:55.511 INFO 11728 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-08-04 12:55:55.511 INFO 11728 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-08-04 12:55:55.558 INFO 11728 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2016-08-04 12:55:56.751 INFO 11728 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL94Dialect
2016-08-04 12:56:48.037 INFO 11728 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2016-08-04 12:56:48.044 INFO 11728 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#6568f998
2016-08-04 12:56:48.738 INFO 11728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#f58853c: startup date [Thu Aug 04 12:55:49 CEST 2016]; root of context hierarchy
2016-08-04 12:56:48.890 INFO 11728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v1/measurement],methods=[POST]}" onto void pl.mypackage.ResponseGenerator.sendMeasurementFromSensorToDatabase(java.util.Map<java.lang.String, java.lang.String>)
2016-08-04 12:56:48.891 INFO 11728 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v1/measurements],methods=[GET],produces=[application/json || text/html]}" onto static org.springframework.http.ResponseEntity<java.lang.String> pl.mypackage.ResponseGenerator.getResponseAdequateToRequest(java.util.Map<java.lang.String, java.lang.String>)
2016-08-04 12:56:48.895 INFO 11728 --- [ 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)
2016-08-04 12:56:48.895 INFO 11728 --- [ 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)
2016-08-04 12:56:48.924 INFO 11728 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-08-04 12:56:48.924 INFO 11728 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-08-04 12:56:48.988 INFO 11728 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-08-04 12:56:49.735 INFO 11728 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-08-04 12:56:49.795 INFO 11728 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 80 (http)
2016-08-04 12:56:49.800 INFO 11728 --- [ main] pl.mypackage.Main : Started Main in 60.881 seconds (JVM running for 61.327)
It started but it took it about 61 seconds to start. Why so long?
Related
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.1.RELEASE)
2018-02-18 14:28:21.922 INFO 12088 --- [ restartedMain]
com.jeeniso.BusinessDashboard : Starting BusinessDashboard on HP-Pavilion with PID 12088 (E:\education\ENISo\JuniorEntreprise\plateforme\BusinessDashboard\target\classes started by chiheb in E:\education\ENISo\JuniorEntreprise\plateforme\BusinessDashboard)
2018-02-18 14:28:21.926 INFO 12088 --- [ restartedMain] com.jeeniso.BusinessDashboard : No active profile set, falling back to default profiles: default
2018-02-18 14:28:22.335 INFO 12088 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#25410cc2: startup date [Sun Feb 18 14:28:22 GMT+01:00 2018]; root of context hierarchy
2018-02-18 14:28:23.834 INFO 12088 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'templateEngine' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=thymeleafWebMvcConfig; factoryMethodName=templateEngine; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/jeeniso/configurations/ThymeleafWebMvcConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration; factoryMethodName=templateEngine; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration.class]]
2018-02-18 14:28:24.176 INFO 12088 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$ceaf63ba] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-02-18 14:28:24.642 INFO 12088 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-02-18 14:28:24.650 INFO 12088 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service Tomcat
2018-02-18 14:28:24.651 INFO 12088 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5
2018-02-18 14:28:24.738 INFO 12088 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-02-18 14:28:24.738 INFO 12088 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2408 ms
2018-02-18 14:28:24.972 INFO 12088 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-02-18 14:28:24.972 INFO 12088 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-02-18 14:28:24.972 INFO 12088 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-02-18 14:28:24.972 INFO 12088 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-02-18 14:28:24.973 INFO 12088 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-02-18 14:28:24.974 INFO 12088 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'resourceUrlEncodingFilter' to: [/*]
2018-02-18 14:28:24.974 INFO 12088 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-02-18 14:28:25.250 INFO 12088 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-02-18 14:28:25.262 INFO 12088 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-02-18 14:28:25.354 INFO 12088 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final}
2018-02-18 14:28:25.355 INFO 12088 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-02-18 14:28:25.356 INFO 12088 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2018-02-18 14:28:25.393 INFO 12088 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-02-18 14:28:25.926 INFO 12088 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
2018-02-18 14:28:26.334 INFO 12088 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
Hibernate: alter table user_role drop constraint FKa68196081fvovjhkek5m97n3y
2018-02-18 14:28:26.338 ERROR 12088 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_role drop constraint FKa68196081fvovjhkek5m97n3y
2018-02-18 14:28:26.338 ERROR 12088 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : user lacks privilege or object not found: PUBLIC.USER_ROLE
Hibernate: alter table user_role drop constraint FK859n2jvi8ivhui0rl0esws6o
2018-02-18 14:28:26.338 ERROR 12088 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_role drop constraint FK859n2jvi8ivhui0rl0esws6o
2018-02-18 14:28:26.338 ERROR 12088 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : user lacks privilege or object not found: PUBLIC.USER_ROLE
Hibernate: drop table role if exists
Hibernate: drop table user if exists
Hibernate: drop table user_role if exists
Hibernate: create table role (id bigint generated by default as identity (start with 1), name varchar(255), primary key (id))
Hibernate: create table user (id bigint generated by default as identity (start with 1), password varchar(255), username varchar(255), primary key (id))
Hibernate: create table user_role (user_id bigint not null, role_id bigint not null, primary key (user_id, role_id))
Hibernate: alter table user_role add constraint FKa68196081fvovjhkek5m97n3y
foreign key (role_id) references role
Hibernate: alter table user_role add constraint FK859n2jvi8ivhui0rl0esws6o
foreign key (user_id) references user
2018-02-18 14:28:26.343 INFO 12088 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2018-02-18 14:28:26.385 INFO 12088 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-02-18 14:28:27.088 WARN 12088 --- [ restartedMain] org.thymeleaf.templatemode.TemplateMode : [THYMELEAF][restartedMain] Template Mode 'HTML5' is deprecated. Using Template Mode 'HTML' instead.
2018-02-18 14:28:27.511 INFO 12088 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#44825d85, org.springframework.security.web.context.SecurityContextPersistenceFilter#7ccf6021, org.springframework.security.web.header.HeaderWriterFilter#b42d62f, org.springframework.security.web.csrf.CsrfFilter#32a5c279, org.springframework.security.web.authentication.logout.LogoutFilter#33f48d12, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#36fc0a7e, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#6299fd96, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#97a4947, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#682244c3, org.springframework.security.web.session.SessionManagementFilter#59c278f9, org.springframework.security.web.access.ExceptionTranslationFilter#4940954c, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#a831613]
2018-02-18 14:28:27.602 INFO 12088 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#25410cc2: startup date [Sun Feb 18 14:28:22 GMT+01:00 2018]; root of context hierarchy
2018-02-18 14:28:27.661 INFO 12088 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/calendar],methods=[GET]}" onto public java.lang.String com.jeeniso.controllers.PageController.calendar()
2018-02-18 14:28:27.662 INFO 12088 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/pricing-tables],methods=[GET]}" onto public java.lang.String com.jeeniso.controllers.PageController.pricingTables()
2018-02-18 14:28:27.662 INFO 12088 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String com.jeeniso.controllers.PageController.plainPage()
2018-02-18 14:28:27.665 INFO 12088 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/registration],methods=[POST]}" onto public java.lang.String com.jeeniso.controllers.UserController.registration(com.jeeniso.models.User,org.springframework.validation.BindingResult,org.springframework.ui.Model)
2018-02-18 14:28:27.666 INFO 12088 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/registration],methods=[GET]}" onto public java.lang.String com.jeeniso.controllers.UserController.registration(org.springframework.ui.Model)
2018-02-18 14:28:27.666 WARN 12088 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'userController' method
public java.lang.String com.jeeniso.controllers.UserController.welcome(org.springframework.ui.Model)
to {[/],methods=[GET]}: There is already 'pageController' bean method
public java.lang.String com.jeeniso.controllers.PageController.plainPage() mapped.
2018-02-18 14:28:27.667 INFO 12088 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-02-18 14:28:27.677 INFO 12088 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service Tomcat
2018-02-18 14:28:27.691 INFO 12088 --- [ restartedMain] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-02-18 14:28:27.699 ERROR 12088 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'userController' method
public java.lang.String
com.jeeniso.controllers.UserController.welcome(org.springframework.ui.Model)
to {[/],methods=[GET]}: There is already 'pageController' bean method
public java.lang.String com.jeeniso.controllers.PageController.plainPage()
mapped.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.ini
tializeBean(AbstractAutowireCapableBeanFactory.java:1583) ~[spring-beans-
4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at com.jeeniso.BusinessDashboard.main(BusinessDashboard.java:19) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.4.1.RELEASE.jar:1.4.1.RELEASE]
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'userController' method
public java.lang.String com.jeeniso.controllers.UserController.welcome(org.springframework.ui.Model)
to {[/],methods=[GET]}: There is already 'pageController' bean method
public java.lang.String com.jeeniso.controllers.PageController.plainPage() mapped.
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.assertUniqueMethodMapping(AbstractHandlerMethodMapping.java:576) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register(AbstractHandlerMethodMapping.java:540) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod(AbstractHandlerMethodMapping.java:264) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:250) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:214) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:184) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:128) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
... 21 common frames omitted
Process finished with exit code 0
as the error message states, your second issue is you have two controllers both mapping to the same endpoint.
UserController.welcome(...) is mapped to GET /
which is exatly the same mapping
PageController.plainPage() is mapped to.
You should add a RequestMapping annotation to the controller to ensure they are different, this could also be done on the methods themselves.
E.g.
#RestController
#RequestMapping("/myController")
public class myController(){
#GetMapping("/")
public String get(){
return "hello world";
}
}
would have a GET mapping of /myController/
Make sure you have few spring boot annotation in your main class :
#SpringBootApplication
#EnableAutoConfiguration
My springboot application is not starting. The eclipse console is not giving any hint. Earlier it used to start, but now its screwed up. Also, my colleague have almost identical workspace. And it app starts on his machine. Is anyone able to spot anything in this eclipse log:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/593932/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/593932/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
2017-07-21 17:22:26.612 DEBUG 7316 --- [ main] o.s.boot.SpringApplication : Loading source class org.springframework.cloud.netflix.eureka.config.EurekaDiscoveryClientConfigServiceBootstrapConfiguration,class org.springframework.cloud.config.client.ConfigServiceBootstrapConfiguration,class org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration,class org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration,class org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration,class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration,class org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
2017-07-21 17:22:26.734 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Activated profiles dev3
2017-07-21 17:22:26.735 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'file:/C:/Mahesh/workspaces/xyzws8/blueprint-graph/target/classes/bootstrap.properties' (classpath:/bootstrap.properties)
2017-07-21 17:22:26.735 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped (empty) config file 'file:/C:/Mahesh/workspaces/xyzws8/blueprint-graph/target/classes/bootstrap.properties' (classpath:/bootstrap.properties) for profile dev3
2017-07-21 17:22:26.741 INFO 7316 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#2118cddf: startup date [Fri Jul 21 17:22:26 IST 2017]; root of context hierarchy
2017-07-21 17:22:27.501 INFO 7316 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-07-21 17:22:27.633 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$7474b600] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:28.183 DEBUG 7316 --- [ main] utoConfigurationReportLoggingInitializer :
=========================
AUTO-CONFIGURATION REPORT
=========================
Positive matches:
-----------------
ConfigServiceBootstrapConfiguration#configServicePropertySource matched:
- #ConditionalOnProperty (spring.cloud.config.enabled) matched (OnPropertyCondition)
ConfigurationPropertiesRebinderAutoConfiguration matched:
- #ConditionalOnBean (types: org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; SearchStrategy: all) found bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' (OnBeanCondition)
ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesBeans matched:
- #ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; SearchStrategy: current) did not find any beans (OnBeanCondition)
ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesRebinder matched:
- #ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder; SearchStrategy: current) did not find any beans (OnBeanCondition)
EncryptionBootstrapConfiguration matched:
- #ConditionalOnClass found required class 'org.springframework.security.crypto.encrypt.TextEncryptor'; #ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer matched:
- #ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) did not find any beans (OnBeanCondition)
Negative matches:
-----------------
ConfigServiceBootstrapConfiguration.RetryConfiguration:
Did not match:
- #ConditionalOnClass did not find required class 'org.springframework.retry.annotation.Retryable' (OnClassCondition)
DiscoveryClientConfigServiceBootstrapConfiguration:
Did not match:
- #ConditionalOnProperty (spring.cloud.config.discovery.enabled) did not find property 'spring.cloud.config.discovery.enabled' (OnPropertyCondition)
EncryptionBootstrapConfiguration.RsaEncryptionConfiguration:
Did not match:
- Keystore nor key found in Environment (EncryptionBootstrapConfiguration.KeyCondition)
Matched:
- #ConditionalOnClass found required class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor'; #ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
EncryptionBootstrapConfiguration.VanillaEncryptionConfiguration:
Did not match:
- #ConditionalOnMissingClass found unwanted class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)
EurekaDiscoveryClientConfigServiceBootstrapConfiguration:
Did not match:
- #ConditionalOnProperty (spring.cloud.config.discovery.enabled) did not find property 'spring.cloud.config.discovery.enabled' (OnPropertyCondition)
Matched:
- #ConditionalOnClass found required class 'org.springframework.cloud.config.client.ConfigServicePropertySourceLocator'; #ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
Exclusions:
-----------
None
Unconditional classes:
----------------------
None
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.3.RELEASE)
2017-07-21 17:22:28.874 INFO 7316 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2017-07-21 17:22:30.026 WARN 7316 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/pqr/dev3": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2017-07-21 17:22:30.029 INFO 7316 --- [ main] com.abc.xyz.pqr.pqrApplication : The following profiles are active: dev3
2017-07-21 17:22:30.033 DEBUG 7316 --- [ main] o.s.boot.SpringApplication : Loading source class com.abc.xyz.pqr.pqrApplication
2017-07-21 17:22:30.056 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Activated profiles dev3
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'jar:file:/C:/Users/593932/.m2/repository/com/abc/xyz/utils/logger/2.0.0.1-SNAPSHOT/logger-2.0.0.1-SNAPSHOT.jar!/application.properties' (classpath:/application.properties)
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'file:/C:/Mahesh/workspaces/xyzws8/pqr-rest/target/classes/application-dev3.properties' (classpath:/application-dev3.properties)
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped (empty) config file 'file:/C:/Mahesh/workspaces/xyzws8/pqr-rest/target/classes/application-dev3.properties' (classpath:/application-dev3.properties) for profile dev3
2017-07-21 17:22:30.057 DEBUG 7316 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped (empty) config file 'jar:file:/C:/Users/593932/.m2/repository/com/abc/xyz/utils/logger/2.0.0.1-SNAPSHOT/logger-2.0.0.1-SNAPSHOT.jar!/application.properties' (classpath:/application.properties) for profile dev3
2017-07-21 17:22:30.057 INFO 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#590c73d3: startup date [Fri Jul 21 17:22:30 IST 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#2118cddf
2017-07-21 17:22:30.061 DEBUG 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#590c73d3: org.springframework.beans.factory.support.DefaultListableBeanFactory#6c67e137: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,pqrApplication]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory#5afa3c9
2017-07-21 17:22:54.813 INFO 7316 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'dataSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]]
2017-07-21 17:22:56.472 INFO 7316 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=913a3bd9-b3c0-3356-9fa2-16200e317e2e
2017-07-21 17:22:56.572 INFO 7316 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-07-21 17:22:56.727 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.abc.xyz.workitem.client.WorkItemClient' of type [org.springframework.cloud.netflix.feign.FeignClientFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.254 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$585ab303] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.706 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$7a847922] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.946 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration' of type [org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration$$EnhancerBySpringCGLIB$$8a875944] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:57.998 INFO 7316 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$7474b600] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-21 17:22:58.013 DEBUG 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource#2589d787]
2017-07-21 17:22:58.013 DEBUG 7316 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster#1788cb61]
2017-07-21 17:22:59.563 DEBUG 7316 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\593932\.m2\repository\org\springframework\boot\spring-boot\1.5.3.RELEASE\spring-boot-1.5.3.RELEASE.jar
2017-07-21 17:22:59.564 DEBUG 7316 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\593932\.m2\repository\org\springframework\boot\spring-boot\1.5.3.RELEASE\spring-boot-1.5.3.RELEASE.jar
2017-07-21 17:22:59.564 DEBUG 7316 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Document root: C:\Mahesh\workspaces\xyzws8\pqr-rest\src\main\webapp
2017-07-21 17:22:59.685 INFO 7316 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 0 (http)
Jul 21, 2017 5:22:59 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Jul 21, 2017 5:22:59 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.14
Jul 21, 2017 5:23:02 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
2017-07-21 17:23:02.138 INFO 7316 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 32081 ms
2017-07-21 17:23:02.513 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Added existing Servlet initializer bean 'dispatcherServletRegistration'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'metricsFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'characterEncodingFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'hiddenHttpMethodFilter'; order=-10000, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'httpPutFormContentFilter'; order=-9900, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'requestContextFilter'; order=-105, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]
2017-07-21 17:23:03.639 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'webRequestLoggingFilter'; order=2147483637, resource=class path resource [org/springframework/boot/actuate/autoconfigure/TraceWebFilterAutoConfiguration.class]
2017-07-21 17:23:03.640 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.s.ServletContextInitializerBeans : Created Filter initializer for bean 'applicationContextIdFilter'; order=2147483647, resource=class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration.class]
2017-07-21 17:23:03.674 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-07-21 17:23:03.700 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2017-07-21 17:23:03.701 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-07-21 17:23:03.720 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-07-21 17:23:03.721 INFO 7316 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-07-21 17:23:03.913 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedRequestContextFilter : Initializing filter 'requestContextFilter'
2017-07-21 17:23:03.916 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedRequestContextFilter : Filter 'requestContextFilter' configured successfully
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.ApplicationContextHeaderFilter : Initializing filter 'applicationContextIdFilter'
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.ApplicationContextHeaderFilter : Filter 'applicationContextIdFilter' configured successfully
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] .s.b.w.f.OrderedHttpPutFormContentFilter : Initializing filter 'httpPutFormContentFilter'
2017-07-21 17:23:03.917 DEBUG 7316 --- [ost-startStop-1] .s.b.w.f.OrderedHttpPutFormContentFilter : Filter 'httpPutFormContentFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedHiddenHttpMethodFilter : Initializing filter 'hiddenHttpMethodFilter'
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedHiddenHttpMethodFilter : Filter 'hiddenHttpMethodFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedCharacterEncodingFilter : Initializing filter 'characterEncodingFilter'
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.w.f.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Initializing filter 'webRequestLoggingFilter'
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Filter 'webRequestLoggingFilter' configured successfully
2017-07-21 17:23:03.918 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Initializing filter 'metricsFilter'
2017-07-21 17:23:03.919 DEBUG 7316 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Filter 'metricsFilter' configured successfully
2017-07-21 17:23:06.527 DEBUG 7316 --- [ main] o.s.b.a.AutoConfigurationPackages : #EnableAutoConfiguration was declared on a class in the package 'com.abc.xyz,com.abc.xyz.pqr'. Automatic #Repository and #Entity scanning is enabled.
2017-07-21 17:23:08.193 INFO 7316 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-07-21 17:23:08.608 INFO 7316 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-07-21 17:23:10.167 INFO 7316 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2017-07-21 17:23:10.180 INFO 7316 --- [ main] org.hibernate.cfg.Environment : HHH000205: Loaded properties from resource hibernate.properties: {hibernate.temp.use_jdbc_metadata_defaults=false, hibernate.bytecode.use_reflection_optimizer=false}
2017-07-21 17:23:10.181 INFO 7316 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-07-21 17:23:10.602 INFO 7316 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-07-21 17:23:11.278 INFO 7316 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: com.abc.xyz.hibernate.dialect.JSONBPostgreSQLDialect
2017-07-21 17:23:11.355 INFO 7316 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000422: Disabling contextual LOB creation as connection was null
2017-07-21 17:23:11.361 INFO 7316 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#18811c42
2017-07-21 17:23:12.153 WARN 7316 --- [ main] org.hibernate.id.UUIDHexGenerator : HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
2017-07-21 17:23:13.606 INFO 7316 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2017-07-21 17:23:15.246 INFO 7316 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-07-21 17:23:15.326 INFO 7316 --- [ main] o.s.aop.framework.CglibAopProxy : Final method [protected final void org.springframework.boot.web.support.SpringBootServletInitializer.setRegisterErrorPageFilter(boolean)] cannot get proxied via CGLIB: Calls to this method will NOT be routed to the target instance and might lead to NPEs against uninitialized fields in the proxy instance.
2017-07-21 17:23:15.908 INFO 7316 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#691eb389: startup date [Fri Jul 21 17:23:15 IST 2017]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#590c73d3
2017-07-21 17:23:16.015 INFO 7316 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Jul 21, 2017 5:23:18 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Tomcat
Is this line an issue?:
2017-07-21 17:23:11.355 INFO 7316 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000422: Disabling contextual LOB creation as connection was null
Earlier I used to get following:
2017-07-21 16:43:44.438 INFO 7008 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
So I added
hibernate.temp.use_jdbc_metadata_defaults=false
to properties file.
Notice that the tomcat stops abruptly (last two lines):
Jul 21, 2017 5:23:18 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Tomcat
Sorry for putting so much log. I put --debug in programs arguments. Is there anything else I can do to get some more information?
Here are some files as requested in comments:
pom file
main class file
Note that I have other applications as dependencies. So they will also be adding many other dependencies which are not getting captured in above pom. How can I share them here?
The main class is really a placeholder which triggers SpringBoot which in turn runs various stuff say load beans, run apache camel routes etc.
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've tried to make an ultra-simplified version of the Spring Bookmark tutorial (using gradle rather than maven). My code can be found here: https://github.com/JetForMe/spring-hoa/tree/master/src/main/java/com/latencyzero/hoa
Among the changes I made was to call "User" what the tutorial calls "Account," and minor stylistic changes that I don't think are causing the problem, but they might be, if it's a name-matching issue (but I think Spring is smart enough to look for types).
In any case, my UserRepository class is not getting instantiated, and therefore not auto-wiring up to the rest of my classes. Poring over the tutorial, I don't see any special effort to instantiate the repositories.
The log shows something that might be a red herring: "Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.latencyzero.hoa.UserRepository."
Here's the full log:
$ gradle bootRun
:compileJava
:processResources
:classes
:findMainClass
:bootRun
2016-10-25 02:53:00.108 INFO 99423 --- [ restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#3f1dba7: startup date [Tue Oct 25 02:53:00 PDT 2016]; root of context hierarchy
2016-10-25 02:53:00.376 INFO 99423 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$8758e0b1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.1.RELEASE)
2016-10-25 02:53:00.593 INFO 99423 --- [ restartedMain] com.latencyzero.hoa.Application : No active profile set, falling back to default profiles: default
2016-10-25 02:53:00.605 INFO 99423 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#ae0374c: startup date [Tue Oct 25 02:53:00 PDT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#3f1dba7
2016-10-25 02:53:01.873 INFO 99423 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'ignoredPathsWebSecurityConfigurerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration; factoryMethodName=ignoredPathsWebSecurityConfigurerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration; factoryMethodName=ignoredPathsWebSecurityConfigurerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.class]]
2016-10-25 02:53:02.047 INFO 99423 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2016-10-25 02:53:02.069 INFO 99423 --- [ restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.latencyzero.hoa.UserRepository.
2016-10-25 02:53:02.150 WARN 99423 --- [ restartedMain] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance #Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static #Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-10-25 02:53:02.367 INFO 99423 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=ca9236f5-9f66-359b-bc2d-0d19b66d24be
2016-10-25 02:53:02.485 INFO 99423 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$6b3eddb4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-25 02:53:02.530 INFO 99423 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$8758e0b1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-25 02:53:02.980 INFO 99423 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-10-25 02:53:02.991 INFO 99423 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-10-25 02:53:02.992 INFO 99423 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5
2016-10-25 02:53:03.076 INFO 99423 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-10-25 02:53:03.076 INFO 99423 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2471 ms
2016-10-25 02:53:03.414 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2016-10-25 02:53:03.414 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-10-25 02:53:03.414 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-10-25 02:53:03.415 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-10-25 02:53:03.415 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-10-25 02:53:03.416 INFO 99423 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2016-10-25 02:53:03.417 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2016-10-25 02:53:03.417 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2016-10-25 02:53:03.417 INFO 99423 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-10-25 02:53:03.457 WARN 99423 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController' defined in file [/Users/rmann/Projects/HOA/spring-hoa/build/classes/main/com/latencyzero/hoa/UserController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency [com.latencyzero.hoa.UserRepository]: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2016-10-25 02:53:03.460 INFO 99423 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service Tomcat
2016-10-25 02:53:03.472 WARN 99423 --- [ restartedMain] o.s.boot.SpringApplication : Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor]: Factory method 'transactionAdvisor' threw exception; nested exception is java.lang.NullPointerException)
2016-10-25 02:53:03.641 ERROR 99423 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in com.latencyzero.hoa.UserController required a bean of type 'com.latencyzero.hoa.UserRepository' that could not be found.
Action:
Consider defining a bean of type 'com.latencyzero.hoa.UserRepository' in your configuration.
BUILD SUCCESSFUL
Total time: 11.941 secs
Any idea what I overlooked? Thanks!
Okay, it turns out I was missing some dependencies. I added spring-boot-starter-data-jpa, and h2. Now I'm getting a different error, but I'll post a new question about that.
I am trying to build a restful service with eclipse, java, gradle, spring-boot and host it on a digital ocean server. I want to get a JSON response when I access the digital ocean url on a specific port or something, so I can do 123.456.78:90 and see JSON in the browser.
When I run this in eclipse and access localhost, this works fine. Accessing localhost:port# gives the desired output, but I'm noticing differences in the console log from eclipse and when I run it on the server.
From eclipse:
2016-01-24 09:42:56.245 INFO 7372 --- [ main] Keen.KeenAPICallTester : Starting KeenAPICallTester on ****-THINK with PID 7372 (C:\Users\****\workspace\****-ML\bin started by **** in C:\Users\****\workspace\****-ML)
2016-01-24 09:42:56.247 INFO 7372 --- [ main] Keen.KeenAPICallTester : No active profile set, falling back to default profiles: default
2016-01-24 09:42:56.299 INFO 7372 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#116af24: startup date [Sun Jan 24 09:42:56 EST 2016]; root of context hierarchy
2016-01-24 09:42:56.893 INFO 7372 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2016-01-24 09:42:57.492 INFO 7372 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 9011 (http)
2016-01-24 09:42:57.502 INFO 7372 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-01-24 09:42:57.503 INFO 7372 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.30
2016-01-24 09:42:57.599 INFO 7372 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-01-24 09:42:57.599 INFO 7372 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1301 ms
2016-01-24 09:42:57.880 INFO 7372 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-01-24 09:42:57.883 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-01-24 09:42:57.884 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-01-24 09:42:57.884 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-01-24 09:42:57.885 INFO 7372 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-01-24 09:42:58.120 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#116af24: startup date [Sun Jan 24 09:42:56 EST 2016]; root of context hierarchy
2016-01-24 09:42:58.183 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/extractionTest],methods=[GET],produces=[application/json]}" onto public java.lang.Object Keen.MLJSONResponseController.testExtractionRequest()
2016-01-24 09:42:58.184 INFO 7372 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/inspectAllProjectsTest],methods=[GET],produces=[application/json]}" onto public java.lang.Object Keen.MLJSONResponseController.testInspectionRequest()
2016-01-24 09:42:58.186 INFO 7372 --- [ 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)
2016-01-24 09:42:58.186 INFO 7372 --- [ 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)
2016-01-24 09:42:58.208 INFO 7372 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-24 09:42:58.208 INFO 7372 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-24 09:42:58.246 INFO 7372 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-24 09:42:58.349 INFO 7372 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-01-24 09:42:58.402 INFO 7372 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9011 (http)
2016-01-24 09:42:58.406 INFO 7372 --- [ main] Keen.KeenAPICallTester : Started KeenAPICallTester in 2.445 seconds (JVM running for 2.739)
From Digital Ocean:
2016-01-24 09:22:11.190 INFO 29453 --- [ main] Keen.KeenAPICallTester : Starting KeenAPICallTester on **** with PID 29453 (/root/java-ml/learning/build/classes/main started by root in /root/java-ml/learning)
2016-01-24 09:22:11.224 INFO 29453 --- [ main] Keen.KeenAPICallTester : No active profile set, falling back to default profiles: default
2016-01-24 09:22:11.949 INFO 29453 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#8b87145: startup date [Sun Jan 24 09:22:11 EST 2016]; root of context hierarchy
2016-01-24 09:22:16.874 INFO 29453 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2016-01-24 09:22:20.350 INFO 29453 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 80 (http)
2016-01-24 09:22:20.448 INFO 29453 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-01-24 09:22:20.457 INFO 29453 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.30
2016-01-24 09:22:21.015 INFO 29453 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-01-24 09:22:21.016 INFO 29453 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 9086 ms
2016-01-24 09:22:22.582 INFO 29453 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-01-24 09:22:22.613 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-01-24 09:22:22.636 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-01-24 09:22:22.637 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-01-24 09:22:22.637 INFO 29453 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
My guess is that for some reason my digital ocean server isn't playing nice with Tomcat or something. I opened ports via the ufw command, checked iptables, installed apache2 (I don't even know if I had to to be honest) and made sure that there were configurations set to accept outbound and inbound requests in port 8080 and 8000.
I noticed that my request methods are not getting mapped, which makes me think that there is some dependency problem. Here is my build.gradle for reference.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.1.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
mainClassName = "Keen.KeenAPICallTester"
applicationDefaultJvmArgs = ["--server.port=8000"]
jar {
baseName = '****-ML'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
compile fileTree(dir: 'libs', include: '*.jar')
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
task(runSimple, dependsOn: 'classes', type: JavaExec) {
main = 'Keen.KeenAPICallTester'
classpath = sourceSets.main.runtimeClasspath
args '--server.port=8000'
}
Is there something wrong with the way I'm handling this? I also have a runSimple command so that I could play with the JVM port run, but it makes no difference, even if I set it to 80 and go straight to the default digital ocean IP address.
I've run applications on digital ocean before and usually it was as simple as opening a specific port via ufw and running the application on the port, then accessing it via the internet. But there's something under the hood that's going on that I would like to understand.
Seems like the application is stuck because it might be waiting for /dev/random (blocking device, might have run dry).
You could use /dev/urandom instead by starting your application passing the JVM-param -Djava.security.egd=file:/dev/./urandom.
See Avoiding JVM Delays Caused by Random Number Generation
Furthermore, to drill down such weird issues, tools such as jstack or strace might be of help.