I am designing web app with spring-boot + hibernate 5. And I am not using any xml files. I am creating data source and sessionFactory, and I am getting error:
Caused by: java.sql.SQLException: ORA-01017: invalid username/password; logon denied
But my username and password are exactly right.
It is my dataSource bean:
#Bean(name = "dataSource")
public DataSource getDataSource(){
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
dataSource.setUsername("system");
dataSource.setPassword("admin");
dataSource.setUrl("jdbc:oracle:thin:#localhost:1521:xe");
return dataSource;
}
It is my sessionFactory bean:
#Autowired
#Bean(name = "sessionFactory")
public SessionFactory generateSessionFactoryBean(DataSource dataSource) throws Exception {
DriverManagerDataSource ds = (DriverManagerDataSource)dataSource;
System.out.println(ds.getUsername() + " " + ds.getPassword());
LocalSessionFactoryBuilder sessionBuilder =
new LocalSessionFactoryBuilder(dataSource);
SessionFactory sessionFactory = sessionBuilder
.scanPackages("org.company")
.setProperties(getHibernateProperties())
.buildSessionFactory();
return sessionFactory;
}
It is my getHibernateProperties() method, which is used in sessionFactory:
public Properties getHibernateProperties(){
Properties properties = new Properties();
properties.put("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect");
properties.put("hibernate.show_sql", "true");
properties.put("hibernate.hbm2ddl.auto", "update");
return properties;
}
And I have hibernate.properties file just in case:
hibernate.connection.url = jdbc:oracle:thin:#localhost:1521:xe
hibernate.connection.username = system
hibernate.connection.user = system
hibernate.connection.password = admin
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.dialect = org.hibernate.dialect.Oracle10gDialect
Part of stack trace:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.3.RELEASE)
2016-04-17 12:59:52.312 INFO 5136 --- [ main] org.company.RestresourceApplication : Starting RestresourceApplication on МорфПК with PID 5136 (D:\NewWorkspace\restresource\target\classes started by Морф in D:\NewWorkspace\restresource)
2016-04-17 12:59:52.317 INFO 5136 --- [ main] org.company.RestresourceApplication : No active profile set, falling back to default profiles: default
2016-04-17 12:59:52.424 INFO 5136 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#22f17321: startup date [Sun Apr 17 12:59:52 EEST 2016]; root of context hierarchy
2016-04-17 12:59:54.527 INFO 5136 --- [ 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-04-17 12:59:55.607 INFO 5136 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$df212fee] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-04-17 12:59:56.878 INFO 5136 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-04-17 12:59:56.898 INFO 5136 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-04-17 12:59:56.899 INFO 5136 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.32
2016-04-17 12:59:57.109 INFO 5136 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-04-17 12:59:57.110 INFO 5136 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4698 ms
2016-04-17 12:59:57.905 INFO 5136 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-04-17 12:59:57.911 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-04-17 12:59:57.912 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-04-17 12:59:57.912 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-04-17 12:59:57.913 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-04-17 12:59:58.110 INFO 5136 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
2016-04-17 13:00:00.223 INFO 5136 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-04-17 13:00:00.280 INFO 5136 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-04-17 13:00:00.631 INFO 5136 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.5.Final}
2016-04-17 13:00:00.636 INFO 5136 --- [ main] org.hibernate.cfg.Environment : HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.username=system , hibernate.connection.password=****, hibernate.dialect=org.hibernate.dialect.Oracle10gDialect, hibernate.connection.user=system, hibernate.connection.url=jdbc:oracle:thin:#localhost:1521:xe, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver}
2016-04-17 13:00:00.637 INFO 5136 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-04-17 13:00:00.738 INFO 5136 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2016-04-17 13:00:00.758 WARN 5136 --- [ main] org.hibernate.orm.deprecation : HHH90000006: Attempted to specify unsupported NamingStrategy via setting [hibernate.ejb.naming_strategy]; NamingStrategy has been removed in favor of the split ImplicitNamingStrategy and PhysicalNamingStrategy; use [hibernate.implicit_naming_strategy] or [hibernate.physical_naming_strategy], respectively, instead.
2016-04-17 13:00:01.295 WARN 5136 --- [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata : ORA-01017: invalid username/password; logon denied
2016-04-17 13:00:01.325 INFO 5136 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
2016-04-17 13:00:01.376 INFO 5136 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000422: Disabling contextual LOB creation as connection was null
2016-04-17 13:07:53.993 ERROR 7432 --- [ main] org.hibernate.hql.spi.id.IdTableHelper : Unable obtain JDBC Connection
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:392) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:385) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:938) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:480) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:416) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:825) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:596) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0]
at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[na:1.8.0_73]
at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[na:1.8.0_73]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:153) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:144) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:155) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:130) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.internal.SessionFactoryImpl$2.obtainConnection(SessionFactoryImpl.java:648) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.hql.spi.id.IdTableHelper.executeIdTableCreationStatements(IdTableHelper.java:67) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy.finishPreparation(GlobalTemporaryTableBulkIdStrategy.java:125) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy.finishPreparation(GlobalTemporaryTableBulkIdStrategy.java:42) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.hql.spi.id.AbstractMultiTableBulkIdStrategyImpl.prepare(AbstractMultiTableBulkIdStrategyImpl.java:88) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:464) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) [hibernate-core-5.0.5.Final.jar:5.0.5.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802) [hibernate-entitymanager-5.0.5.Final.jar:5.0.5.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) [spring-orm-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) [spring-orm-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:319) [spring-orm-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.company.RestresourceApplication.main(RestresourceApplication.java:112) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_73]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_73]
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478) [spring-boot-maven-plugin-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_73]
2016-04-17 13:07:54.006 INFO 7432 --- [ main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
2016-04-17 13:07:54.162 WARN 7432 --- [ main] o.h.hql.internal.ast.HqlSqlWalker : [DEPRECATION] Encountered positional parameter near line 1, column 49 in HQL: [from org.company.model.User user where userId = ?]. Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
system admin
2016-04-17 13:07:54.386 WARN 7432 --- [ main] org.hibernate.orm.connections : HHH10001002: Using Hibernate built-in connection pool (not for production use!)
2016-04-17 13:07:54.390 INFO 7432 --- [ main] org.hibernate.orm.connections : HHH10001005: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:#localhost:1521:xe]
2016-04-17 13:07:54.390 INFO 7432 --- [ main] org.hibernate.orm.connections : HHH10001001: Connection properties: {user=system , password=****}
2016-04-17 13:07:54.393 INFO 7432 --- [ main] org.hibernate.orm.connections : HHH10001003: Autocommit mode: false
2016-04-17 13:07:54.399 INFO 7432 --- [ main] .c.i.DriverManagerConnectionProviderImpl : HHH000115: Hibernate connection pool size: 20 (min=1)
2016-04-17 13:07:54.451 WARN 7432 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.company.service.UserService org.company.controller.UserController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.company.dao.UserDAO org.company.service.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory org.company.dao.UserDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in org.company.RestresourceApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'generateSessionFactoryBean' threw exception; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2016-04-17 13:07:54.456 INFO 7432 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2016-04-17 13:07:54.461 INFO 7432 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2016-04-17 13:07:54.508 ERROR 7432 --- [ main] o.s.boot.SpringApplication : Application startup failed
Any help is appreciated.
Is it possible, that you have whitespace in your hibernate.properties hibernate.connection.username? Guessing from logging output:
{hibernate.connection.username=system ,
This is because of a bug in oracle.
you enter the username and password right. but it is sent in a different way, it could be change of your password from uppercase to lowercase or lowercase to uppercase. I solved this problem by changing my oracle password to uppercase.
you should try it too.
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
I am creating a security service using spring JPA annotation based.
in the datasource configuration of application.properties I have following configurations
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto= update.
I am getting the following errors
objc[22745]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java (0x10c8dc4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10c9a44e0). One of the two will be used. Which one is undefined.
HOTSWAP AGENT: 15:32:22.999 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.1.0-SNAPSHOT} - unlimited runtime class redefinition.
HOTSWAP AGENT: 15:32:23.616 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'sun.misc.Launcher$AppClassLoader#18b4aac2'.
HOTSWAP AGENT: 15:32:23.757 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, WatchResources, AnonymousClassPatch, ClassInitPlugin, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Seam, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, JavaBeans, GlassFish]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.9.RELEASE)
HOTSWAP AGENT: 15:32:24.543 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.spring.SpringPlugin' initialized in ClassLoader 'sun.misc.Launcher$AppClassLoader#18b4aac2'.
HOTSWAP AGENT: 15:32:24.544 INFO (org.hotswap.agent.plugin.spring.SpringPlugin) - Spring plugin initialized - Spring core version '4.3.13.RELEASE'
2018-01-07 15:32:24.598 INFO 22745 --- [ main] .s.SpringSecurityWithDatabaseApplication : Starting SpringSecurityWithDatabaseApplication on C02V7092HTD6 with PID 22745 (/Users/yvxm035/personal-workspace/SpringSecurityWithDatabase/target/classes started by yvxm035 in /Users/yvxm035/personal-workspace/SpringSecurityWithDatabase)
2018-01-07 15:32:24.600 INFO 22745 --- [ main] .s.SpringSecurityWithDatabaseApplication : No active profile set, falling back to default profiles: default
2018-01-07 15:32:24.642 INFO 22745 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#c86b9e3: startup date [Sun Jan 07 15:32:24 CST 2018]; root of context hierarchy
HOTSWAP AGENT: 15:32:24.759 INFO (org.hotswap.agent.plugin.spring.SpringPlugin) - Registering basePackage com.security.services
HOTSWAP AGENT: 15:32:25.268 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'javax.management.remote.rmi.NoCallStackClassLoader#2f943d71'.
HOTSWAP AGENT: 15:32:25.318 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'javax.management.remote.rmi.NoCallStackClassLoader#3dfc5fb8'.
HOTSWAP AGENT: 15:32:25.923 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hibernate.HibernatePlugin' initialized in ClassLoader 'sun.misc.Launcher$AppClassLoader#18b4aac2'.
2018-01-07 15:32:26.249 INFO 22745 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8084 (http)
2018-01-07 15:32:26.260 INFO 22745 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-01-07 15:32:26.261 INFO 22745 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23
HOTSWAP AGENT: 15:32:26.396 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'TomcatEmbeddedWebappClassLoader
context: ROOT
delegate: true
----------> Parent Classloader:
sun.misc.Launcher$AppClassLoader#18b4aac2
'.
HOTSWAP AGENT: 15:32:26.396 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.tomcat.TomcatPlugin' initialized in ClassLoader 'TomcatEmbeddedWebappClassLoader
context: ROOT
delegate: true
----------> Parent Classloader:
sun.misc.Launcher$AppClassLoader#18b4aac2
'.
HOTSWAP AGENT: 15:32:26.397 INFO (org.hotswap.agent.plugin.tomcat.TomcatPlugin) - Tomcat plugin initialized - Tomcat version '8.5.23.0'
2018-01-07 15:32:26.415 INFO 22745 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-01-07 15:32:26.416 INFO 22745 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1777 ms
2018-01-07 15:32:26.603 INFO 22745 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-01-07 15:32:26.608 INFO 22745 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-01-07 15:32:26.608 INFO 22745 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-01-07 15:32:26.608 INFO 22745 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-01-07 15:32:26.608 INFO 22745 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-01-07 15:32:27.177 INFO 22745 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-01-07 15:32:27.191 INFO 22745 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-01-07 15:32:27.345 INFO 22745 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2018-01-07 15:32:27.346 INFO 22745 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-01-07 15:32:27.348 INFO 22745 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2018-01-07 15:32:27.403 INFO 22745 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-01-07 15:32:27.550 INFO 22745 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2018-01-07 15:32:27.791 INFO 22745 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2018-01-07 15:32:27.792 INFO 22745 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#4be0a27d
2018-01-07 15:32:28.273 INFO 22745 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2018-01-07 15:32:28.340 WARN 22745 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 42703
2018-01-07 15:32:28.341 ERROR 22745 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: column t1.tgconstrname does not exist
Position: 113
2018-01-07 15:32:28.344 WARN 22745 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2018-01-07 15:32:28.347 INFO 22745 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-01-07 15:32:28.360 INFO 22745 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-01-07 15:32:28.368 ERROR 22745 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at com.security.services.SpringSecurityWithDatabaseApplication.main(SpringSecurityWithDatabaseApplication.java:10) [classes/:na]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider._createContainerEntityManagerFactorySpringHibernateJpaPersistenceProvider(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:382) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
... 16 common frames omitted
Caused by: org.hibernate.exception.SQLGrammarException: Error accessing column metadata: users
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.convertSQLException(InformationExtractorJdbcDatabaseMetaDataImpl.java:99) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getForeignKeys(InformationExtractorJdbcDatabaseMetaDataImpl.java:679) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.extract.internal.TableInformationImpl.foreignKeys(TableInformationImpl.java:88) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.extract.internal.TableInformationImpl.getForeignKey(TableInformationImpl.java:99) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.findMatchingForeignKey(SchemaMigratorImpl.java:398) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applyForeignKeys(SchemaMigratorImpl.java:376) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigrationToTargets(SchemaMigratorImpl.java:214) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:60) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:134) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:472) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
... 24 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: column t1.tgconstrname does not exist
Position: 113
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:405) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:285) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedExportedKeys(AbstractJdbc2DatabaseMetaData.java:3580) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedKeys(AbstractJdbc2DatabaseMetaData.java:3775) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getForeignKeys(InformationExtractorJdbcDatabaseMetaDataImpl.java:628) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
... 35 common frames omitted
I made sure that I dont have user table as it is a keyword in postgres sql.
And it is working fine and creating the schema when I am using
spring.jpa.hibernate.ddl-auto= create-drop.
But I am not using create-drop as the schema and data will be dropped as soon as the application is stopped and restarted which would be not desired in production.
Please help where I am missing it. I can add more details about the schema I am using and Entities I have in the application. Any help or source of information is appreciated.
Do I have to add any special dependencies while using postgres? I have the PostgresSQl driver dependency in the POM.
Faced the same problem.
Check your version of postgresql driver in POM file.
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212.jre7</version>
</dependency>
This version is working for me.
Finally after multiple trials and searching for the solution. I found spring.jpa.hibernate.ddl-auto= validate does the trick. Instead of spring.jpa.hibernate.ddl-auto= update. Now my schema is working in prod and staging without destroying the schema and recreating for start and stop of the application. Any correction or suggestion on the solution is still appreciated.
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 modeling my code off of this code online:
https://github.com/snicoll-demos/demo-multi-entity-managers
This is my console output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.6.RELEASE)
2016-08-15 11:30:45.586 INFO 8056 --- [ main] database.Application : Starting Application on LR90KLWJY with PID 8056 (C:\Users\vincni\git\consumer_load_method\bin started by vincni in C:\Users\vincni\git\consumer_load_method)
2016-08-15 11:30:45.586 INFO 8056 --- [ main] database.Application : No active profile set, falling back to default profiles: default
2016-08-15 11:30:45.633 INFO 8056 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#15bfd87: startup date [Mon Aug 15 11:30:45 PDT 2016]; root of context hierarchy
2016-08-15 11:30:46.789 INFO 8056 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'lmPersistenceUnit'
2016-08-15 11:30:46.804 INFO 8056 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: lmPersistenceUnit
...]
2016-08-15 11:30:46.867 INFO 8056 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.11.Final}
2016-08-15 11:30:46.867 INFO 8056 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-08-15 11:30:46.867 INFO 8056 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-08-15 11:30:47.023 INFO 8056 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2016-08-15 11:30:47.647 WARN 8056 --- [ main] o.h.e.j.d.i.StandardDialectResolver : HHH000385: Unknown Microsoft SQL Server major version [12] using SQL Server 2000 dialect
2016-08-15 11:30:47.662 INFO 8056 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
2016-08-15 11:30:47.693 INFO 8056 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2016-08-15 11:30:47.771 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2016-08-15 11:30:47.771 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2016-08-15 11:30:47.771 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2016-08-15 11:30:47.771 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000232: Schema update complete
2016-08-15 11:30:47.818 INFO 8056 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'mtsPersistentUnit'
2016-08-15 11:30:47.818 INFO 8056 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: mtsPersistentUnit
...]
2016-08-15 11:30:48.005 INFO 8056 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServer2008Dialect
2016-08-15 11:30:48.005 INFO 8056 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2016-08-15 11:30:48.005 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2016-08-15 11:30:48.005 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2016-08-15 11:30:48.005 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2016-08-15 11:30:48.005 INFO 8056 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000232: Schema update complete
2016-08-15 11:30:48.068 WARN 8056 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demo' defined in database.Application: Unsatisfied dependency expressed through constructor argument with index 0 of type [database.loadmethod.repositories.LoadMethodRepository]: No qualifying bean of type [database.loadmethod.repositories.LoadMethodRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [database.loadmethod.repositories.LoadMethodRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
2016-08-15 11:30:48.083 INFO 8056 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'mtsPersistentUnit'
2016-08-15 11:30:48.083 INFO 8056 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'lmPersistenceUnit'
2016-08-15 11:30:48.083 ERROR 8056 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demo' defined in database.Application: Unsatisfied dependency expressed through constructor argument with index 0 of type [database.loadmethod.repositories.LoadMethodRepository]: No qualifying bean of type [database.loadmethod.repositories.LoadMethodRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [database.loadmethod.repositories.LoadMethodRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:464) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at database.Application.main(Application.java:25) [bin/:na]
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [database.loadmethod.repositories.LoadMethodRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
... 18 common frames omitted
2016-08-15 11:30:48.083 INFO 8056 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/Users/vincni/git/consumer_load_method/bin/, file:/C:/apps/Ivy/cache/org.apache.camel/camel-ftp/jars/camel-ftp-2.16.1.jar, file:/C:/apps/Ivy/cache/org.apache.camel/camel-core/bundles/camel-core-2.16.1.jar, file:/C:/apps/Ivy/cache/com.sun.xml.bind/jaxb-core/jars/jaxb-core-2.2.11.jar, file:/C:/apps/Ivy/cache/com.sun.xml.bind/jaxb-impl/jars/jaxb-impl-2.2.11.jar, file:/C:/apps/Ivy/cache/com.jcraft/jsch/jars/jsch-0.1.53.jar, file:/C:/apps/Ivy/cache/commons-net/commons-net/jars/commons-net-3.3.jar, file:/C:/apps/Ivy/cache/com.zaxxer/HikariCP/jars/HikariCP-2.4.7.jar, file:/C:/apps/Ivy/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.21.jar, file:/C:/apps/Ivy/cache/org.springframework.boot/spring-boot-starter-data-jpa/jars/spring-boot-starter-data-jpa-1.3.6.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework.boot/spring-boot-starter/jars/spring-boot-starter-1.3.6.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework.boot/spring-boot/jars/spring-boot-1.3.6.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-core/jars/spring-core-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-context/jars/spring-context-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-aop/jars/spring-aop-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/aopalliance/aopalliance/jars/aopalliance-1.0.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-beans/jars/spring-beans-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-expression/jars/spring-expression-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework.boot/spring-boot-autoconfigure/jars/spring-boot-autoconfigure-1.3.6.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework.boot/spring-boot-starter-logging/jars/spring-boot-starter-logging-1.3.6.RELEASE.jar, file:/C:/apps/Ivy/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.7.jar, file:/C:/apps/Ivy/cache/ch.qos.logback/logback-core/jars/logback-core-1.1.7.jar, file:/C:/apps/Ivy/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.21.jar, file:/C:/apps/Ivy/cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.7.21.jar, file:/C:/apps/Ivy/cache/org.slf4j/log4j-over-slf4j/jars/log4j-over-slf4j-1.7.21.jar, file:/C:/apps/Ivy/cache/org.yaml/snakeyaml/bundles/snakeyaml-1.16.jar, file:/C:/apps/Ivy/cache/org.springframework.boot/spring-boot-starter-aop/jars/spring-boot-starter-aop-1.3.6.RELEASE.jar, file:/C:/apps/Ivy/cache/org.aspectj/aspectjweaver/jars/aspectjweaver-1.8.9.jar, file:/C:/apps/Ivy/cache/org.springframework.boot/spring-boot-starter-jdbc/jars/spring-boot-starter-jdbc-1.3.6.RELEASE.jar, file:/C:/apps/Ivy/cache/org.apache.tomcat/tomcat-jdbc/jars/tomcat-jdbc-8.0.36.jar, file:/C:/apps/Ivy/cache/org.apache.tomcat/tomcat-juli/jars/tomcat-juli-8.0.36.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-jdbc/jars/spring-jdbc-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-tx/jars/spring-tx-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.hibernate/hibernate-entitymanager/jars/hibernate-entitymanager-4.3.11.Final.jar, file:/C:/apps/Ivy/cache/org.jboss.logging/jboss-logging/jars/jboss-logging-3.3.0.Final.jar, file:/C:/apps/Ivy/cache/org.jboss.logging/jboss-logging-annotations/jars/jboss-logging-annotations-1.2.0.Beta1.jar, file:/C:/apps/Ivy/cache/org.hibernate/hibernate-core/jars/hibernate-core-4.3.11.Final.jar, file:/C:/apps/Ivy/cache/dom4j/dom4j/jars/dom4j-1.6.1.jar, file:/C:/apps/Ivy/cache/xml-apis/xml-apis/jars/xml-apis-1.0.b2.jar, file:/C:/apps/Ivy/cache/org.hibernate.common/hibernate-commons-annotations/jars/hibernate-commons-annotations-4.0.5.Final.jar, file:/C:/apps/Ivy/cache/org.hibernate.javax.persistence/hibernate-jpa-2.1-api/jars/hibernate-jpa-2.1-api-1.0.0.Final.jar, file:/C:/apps/Ivy/cache/org.javassist/javassist/bundles/javassist-3.18.1-GA.jar, file:/C:/apps/Ivy/cache/antlr/antlr/jars/antlr-2.7.7.jar, file:/C:/apps/Ivy/cache/org.jboss/jandex/jars/jandex-1.1.0.Final.jar, file:/C:/apps/Ivy/cache/javax.transaction/javax.transaction-api/jars/javax.transaction-api-1.2.jar, file:/C:/apps/Ivy/cache/org.springframework.data/spring-data-jpa/jars/spring-data-jpa-1.9.4.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework.data/spring-data-commons/jars/spring-data-commons-1.11.4.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-orm/jars/spring-orm-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.springframework/spring-aspects/jars/spring-aspects-4.2.7.RELEASE.jar, file:/C:/apps/Ivy/cache/org.apache.camel/camel-jpa/jars/camel-jpa-2.10.0.jar, file:/C:/apps/Ivy/cache/org.apache.camel/camel-spring/bundles/camel-spring-2.10.0.jar, file:/C:/apps/Ivy/cache/org.apache.poi/poi/jars/poi-3.10.1.jar, file:/C:/apps/Ivy/cache/commons-codec/commons-codec/jars/commons-codec-1.5.jar, file:/C:/apps/Ivy/cache/org.apache.poi/poi-ooxml/jars/poi-ooxml-3.10.1.jar, file:/C:/apps/Ivy/cache/org.apache.poi/poi-ooxml-schemas/jars/poi-ooxml-schemas-3.10.1.jar, file:/C:/apps/Ivy/cache/org.apache.xmlbeans/xmlbeans/jars/xmlbeans-2.6.0.jar, file:/C:/apps/Ivy/cache/stax/stax-api/jars/stax-api-1.0.1.jar, file:/C:/apps/Ivy/cache/com.microsoft.sqlserver/sqljdbc4/jars/sqljdbc4-4.0.jar, file:/C:/ExternalJARS/ojdbc7.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/eclipselink.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/jpa/javax.persistence_2.1.0.v201304241213.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/jpa/org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/jpa/org.eclipse.persistence.jpars_2.5.2.v20140319-9ad6abd.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/moxy/com.sun.tools.xjc_2.2.0.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/moxy/com.sun.xml.bind_2.2.0.v201004141950.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/moxy/javax.activation_1.1.0.v201108011116.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/moxy/javax.mail_1.4.0.v201005080615.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/moxy/javax.xml.bind_2.2.0.v201105210648.jar, file:/C:/Users/vincni/workspace/workspace_lmt/libraries/EclipseLink%202.5.2/eclipselink/jlib/moxy/javax.xml.stream_1.0.1.v201004272200.jar]
This is my application file:
#SpringBootApplication//(exclude = HibernateJpaAutoConfiguration.class)
//#EnableJpaRepositories(basePackageClasses = {LoadMethodRepository.class /*, TBL_GroupRepository.class*/})
//#EntityScan(basePackageClasses = {LoadMethodDO.class /*, TBL_GroupDO.class*/})
//#EnableCaching
public class Application {
private static final Logger log = LoggerFactory.getLogger(Application.class);
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
#Bean
public CommandLineRunner demo(LoadMethodRepository lm_repo /*, LMClientRepository lmc_repo */) {
return (args) -> {
System.out.println("*********Media ID**************");
System.out.println(lm_repo.findOne("4948460").getMediaId());
System.out.println("*********Media ID**************");
};
}
This is my config file for one of my databases:
#Configuration
#EnableJpaRepositories(entityManagerFactoryRef = "lmEntityManagerFactory",
transactionManagerRef = "lmTransactionManager",
basePackageClasses = {EventsWithCommentsDO.class, LMClientDO.class, LoadMethodDO.class})
#EnableTransactionManagement
class LM_Config {
#Bean
#Primary
#ConfigurationProperties(prefix="spring.datasource")
public DataSource lmDataSource() {
return DataSourceBuilder.create().build();
}
#Bean
#Primary
LocalContainerEntityManagerFactoryBean lmEntityManagerFactory(final EntityManagerFactoryBuilder builder) {
return builder.dataSource(lmDataSource())
.packages("lmDataObjects")
.persistenceUnit("lmPersistenceUnit")
.build();
}
#Bean
#Primary
PlatformTransactionManager lmTransactionManager( #Qualifier("lmEntityManagerFactory") final EntityManagerFactory factory ) {
return new JpaTransactionManager(factory);
}
}
This is my config file for the other database:
#Configuration
#EnableJpaRepositories(entityManagerFactoryRef = "mtsEntityManagerFactory",
transactionManagerRef = "mtsTransactionManager",
basePackages = "database.mts.dataobjects")
public class MTS_Config {
#Bean
#ConfigurationProperties(prefix="spring.mtsDatasource")
public DataSource mtsDataSource() {
return DataSourceBuilder.create().build();
}
#Bean
LocalContainerEntityManagerFactoryBean mtsEntityManagerFactory(final EntityManagerFactoryBuilder builder) {
return builder.dataSource(mtsDataSource())
.packages("mtsDataObjects")
.persistenceUnit("mtsPersistentUnit")
.build();
}
#Bean
PlatformTransactionManager mtsTransactionManager( #Qualifier("mtsEntityManagerFactory") final EntityManagerFactory factory ) {
return new JpaTransactionManager(factory);
}
}
This is my properties file:
spring.jpa.generate-ddl=true
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.DefaultNamingStrategy
spring.datasource.username=xxxxdev
spring.datasource.password=xxxx
spring.datasource.url=jdbc:sqlserver://scherwqvsqlaod:1433;database=dbMOBClientTemp;integratedSecurity=false;
spring.datasource.testOnBorrow=true
spring.datasource.validationQuery=SELECT 1
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.jpa.database=dbMOBClientTemp
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.mtsDatasource.username=xxxx
spring.mtsDatasource.password=xxxx
spring.mtsDatasource.url=jdbc:sqlserver://SCHQVSQERLCON2:1433;database=dbMTS;integratedSecurity=false;
spring.mtsDatasource.testOnBorrow=true
spring.mtsDatasource.validationQuery=SELECT 1
spring.mtsDatasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.default_schema=dbo
hibernate.packagesToScan=src.repositories.LMClientRepository.java
My data object files are just POJO DOs, I have the entity, table, column, and Id annotations.
My load method repository file looks like this
public interface LoadMethodRepository extends CrudRepository<LoadMethodDO, String>{
}
My project structure is such that I have the application.java file at the topmost level. Every DO, repo, and config file is beneath -- similar to the project linked above.
The problem as I see is:
No qualifying bean of type [database.loadmethod.repositories.LoadMethodRepository] found
I think your application have mismatch in configuration. Please, try configure Spring setting where it should search for repositories by adding following annotation to the Application.class:
#ComponentScan(basePackageClasses = DataConfig.class)
You also need to create corresponding configuration file DataConfig:
#Configuration
#EnableAutoConfiguration
#ComponentScan({"database.loadmethod.repositories"})
#Import({LM_Config.class, MTS_Config.class})
public class DataConfig {
}
Hope this will help.
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?