Spring Boot: Repository and Entity beans not recognized error - java
My code doesn't seem to recognize some of my repositories and entity classes. I have two databases, LoadMethod and MTS, that I am dealing with. I have had this error for about two days and everything I've found online has mentioned bad package names or missing annotations, but I seem to have all of that to my knowledge.
This is my project package structure:
This is my console output:
2016-08-16 09:03:13.310 INFO 4724 --- [ main] database.Application : Starting Application on LR90KLWJY with PID 4724 (C:\Users\vincni\git\consumer_load_method\bin started by vincni in C:\Users\vincni\git\consumer_load_method)
2016-08-16 09:03:13.313 INFO 4724 --- [ main] database.Application : No active profile set, falling back to default profiles: default
2016-08-16 09:03:13.357 INFO 4724 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#15bfd87: startup date [Tue Aug 16 09:03:13 PDT 2016]; root of context hierarchy
2016-08-16 09:03:14.080 INFO 4724 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'TBL_GroupRepository' with a different definition: replacing [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2016-08-16 09:03:14.652 INFO 4724 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'lmPersistenceUnit'
2016-08-16 09:03:14.679 INFO 4724 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: lmPersistenceUnit
...]
2016-08-16 09:03:14.757 INFO 4724 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.11.Final}
2016-08-16 09:03:14.758 INFO 4724 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-08-16 09:03:14.760 INFO 4724 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-08-16 09:03:14.960 INFO 4724 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2016-08-16 09:03:15.715 WARN 4724 --- [ main] o.h.e.j.d.i.StandardDialectResolver : HHH000385: Unknown Microsoft SQL Server major version [12] using SQL Server 2000 dialect
2016-08-16 09:03:15.720 INFO 4724 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
2016-08-16 09:03:15.851 INFO 4724 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2016-08-16 09:03:16.062 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2016-08-16 09:03:16.062 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2016-08-16 09:03:16.063 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2016-08-16 09:03:16.090 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: dbMOBClientTemp.dbo.Client
2016-08-16 09:03:16.090 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [expndedidind, isd_lupd_ts, client_id, isd_lupd_id]
2016-08-16 09:03:16.090 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: []
2016-08-16 09:03:16.090 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [pxclient]
2016-08-16 09:03:16.101 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: dbMOBClientTemp.dbo.LoadMethod
2016-08-16 09:03:16.101 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [actind, loadmthdcd, dtltransrcdind, media_id, acctmngdind, formatmapcd, isd_lupd_ts, isd_lupd_id]
2016-08-16 09:03:16.101 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: []
2016-08-16 09:03:16.101 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [pxldmthd]
2016-08-16 09:03:16.110 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: dbMOBClientTemp.dbo.LoadMethodClient
2016-08-16 09:03:16.110 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [media_id, isd_lupd_ts, client_id, isd_lupd_id]
2016-08-16 09:03:16.110 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: [rcmedialm, rcclientlm]
2016-08-16 09:03:16.110 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [pxlmc]
2016-08-16 09:03:16.117 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: dbMOBClientTemp.dbo.LoadMethodComments
2016-08-16 09:03:16.117 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [ec_sk, media_id, cmt, isd_lupd_ts, isd_lupd_id]
2016-08-16 09:03:16.118 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: [rcmediaid]
2016-08-16 09:03:16.118 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [pxlmcmt]
2016-08-16 09:03:16.118 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000232: Schema update complete
2016-08-16 09:03:16.163 INFO 4724 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'mtsPersistentUnit'
2016-08-16 09:03:16.163 INFO 4724 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: mtsPersistentUnit
...]
2016-08-16 09:03:16.382 INFO 4724 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServer2008Dialect
2016-08-16 09:03:16.386 INFO 4724 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2016-08-16 09:03:16.392 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2016-08-16 09:03:16.392 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2016-08-16 09:03:16.392 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2016-08-16 09:03:16.418 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: dbMTS.dbo.tblGROUP
2016-08-16 09:03:16.418 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [date_updated, penalty_ind, media_count, y2k_advised, download_full, label_spec, who_entered, group_inactive, report_preference, edi_type, prod_test_ind, late_status, frequency, g_tech_num, media_type, control_number, hot_loadt, media_id, date_entered, id, mit_id, emc_synch_flag, who_updated, block_size, strategic_group, report_processor, format_program, gmisc_flag_2, gmisc_flag_1, gmisc_flag_3, record_size, four_digit_year, respon_anal, time_updated, open_enroll_mnth, use_tpa_contact, ol_id, fk_tpa_id, zeke_event, name, time_entered, package_name, group_maint_ind, elig_password, edt_advised, need_labels, spanned_zipfile]
2016-08-16 09:03:16.418 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: [rcgrpadmin]
2016-08-16 09:03:16.418 INFO 4724 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [pxgroup]
2016-08-16 09:03:16.419 INFO 4724 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000232: Schema update complete
2016-08-16 09:03:16.628 WARN 4724 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TBL_GroupRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not an managed type: class database.mts.dataobjects.TBL_GroupDO
2016-08-16 09:03:16.630 INFO 4724 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'mtsPersistentUnit'
2016-08-16 09:03:16.630 INFO 4724 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'lmPersistenceUnit'
2016-08-16 09:03:16.636 ERROR 4724 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TBL_GroupRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not an managed type: class database.mts.dataobjects.TBL_GroupDO
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[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:753) ~[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:30) [bin/:na]
Caused by: java.lang.IllegalArgumentException: Not an managed type: class database.mts.dataobjects.TBL_GroupDO
at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:219) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:68) ~[spring-data-jpa-1.9.4.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:67) ~[spring-data-jpa-1.9.4.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:152) ~[spring-data-jpa-1.9.4.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:99) ~[spring-data-jpa-1.9.4.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-1.9.4.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) ~[spring-data-jpa-1.9.4.RELEASE.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE]
... 15 common frames omitted
2016-08-16 09:03:16.639 INFO 4724 --- [ 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 config file:
package database.mts;
//all my imports//
#Configuration
#EnableJpaRepositories(entityManagerFactoryRef = "mtsEntityManagerFactory",
transactionManagerRef = "mtsTransactionManager")
public class MTS_Config {
#Bean
#Primary
#ConfigurationProperties(prefix="spring.mtsDatasource")
public DataSource mtsDataSource() {
return DataSourceBuilder.create().build();
}
#Bean
#Primary
LocalContainerEntityManagerFactoryBean mtsEntityManagerFactory(final EntityManagerFactoryBuilder builder) {
return builder.dataSource(mtsDataSource())
.packages("database.mts.dataobjects")
.persistenceUnit("mtsPersistentUnit")
.build();
}
#Bean
#Primary
PlatformTransactionManager mtsTransactionManager( #Qualifier("mtsEntityManagerFactory") final EntityManagerFactory factory ) {
return new JpaTransactionManager(factory);
}
}
This is my other config file:
package database.loadmethod;
#Configuration
#EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
transactionManagerRef = "transactionManager")
public class LM_Config {
#Bean
#ConfigurationProperties(prefix="spring.datasource")
public DataSource lmDataSource() {
return DataSourceBuilder.create().build();
}
#Bean(name = "entityManagerFactory")
LocalContainerEntityManagerFactoryBean lmEntityManagerFactory(final EntityManagerFactoryBuilder builder) {
return builder.dataSource(lmDataSource())
.packages("database.loadmethod.dataobjects")
.persistenceUnit("lmPersistenceUnit")
.build();
}
#Bean(name = "transactionManager")
PlatformTransactionManager lmTransactionManager( #Qualifier("entityManagerFactory") final EntityManagerFactory factory ) {
return new JpaTransactionManager(factory);
}
}
This is my entity object of interest (the one that doesnt seem to be recognized):
package database.mts.dataobjects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="tblGROUP")
public class TBL_GroupDO {
#Id
#Column(name="ID")
private String id;
#Column(name="MEDIA_ID")
private String mediaId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
}
This is the repository of interest:
package database.mts.repositories;
import org.springframework.data.repository.CrudRepository;
import database.mts.dataobjects.TBL_GroupDO;
public interface TBL_GroupRepository extends CrudRepository<TBL_GroupDO, String>{
}
This is my application file:
package database;
//imports//
#SpringBootApplication//(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class})
#EnableJpaRepositories //(basePackages = {"database.loadmethod.repositories", "database.mts.repositories"})
//#EntityScan(basePackages = {"database.loadmethod.dataobjects", "database.mts.dataobjects"})
//#EntityScan
//#EnableTransactionManagement
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, TBL_GroupRepository tblg_repo /*, LMClientRepository lmc_repo */) {
return (args) -> {
System.out.println("*********Media ID**************");
System.out.println(lm_repo.findOne("4948460").getMediaId());
System.out.println("*********Media ID**************");
System.out.println(tblg_repo.findOne("8").getMediaId());
System.out.println("*********Media ID**************");
};
}
}
This is my properties file:
spring.jpa.generate-ddl=true
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.DefaultNamingStrategy
spring.datasource.username=xxxx
spring.datasource.password=xxx
spring.datasource.url=jdbc:sqlserver://xxx:1433;database=xxx;integratedSecurity=false;
spring.datasource.testOnBorrow=true
spring.datasource.validationQuery=SELECT 1
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.jpa.database=xxx
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.mtsDatasource.username=xxx
spring.mtsDatasource.password=xxxxx
spring.mtsDatasource.url=jdbc:sqlserver://VSQLCON2: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
Related
Cant reach Endpoint in Controller, despite it beeing intialised
I read this and this The main ideas are that somebody has the wrong structure and components are not beeing scanned, I have a correct one. My controller is beeing initialised normaly. I tested it debugging and seting the breakpoint on the contructor. It is beiing runned. DEspite of the that the endpoint could not be reached by my tests nor by postman, nor in the browser. I am getting a 404. I am using gradle. structured my code like this. Already spent 3 Hours trying to fix this, but without success. My controller looks like this. package com.fressnapf.microservices.orderhistory.controller.impl; #RestController #RequestMapping("/customer") public class OrderHistoryController implements IOrderHistoryController { ... #Override #ResponseStatus(value = HttpStatus.OK) #RequestMapping(value = "/{customerid}/orders}", method = RequestMethod.GET, produces = "application/json") public String getOrders(#PathVariable("customerid") String customerid, #RequestParam(required = false) String timeFrom, #RequestParam(required = false) String timeTo, #RequestParam(required = false) String openOnly) { ... } } Aplplication class package com.fressnapf.microservices.orderhistory; #SpringBootApplication() #ImportResource({"classpath*:applicationContext.xml"}) #Configuration() public class Application { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); } } this is the response I am getting { "timestamp": "2020-03-03T16:00:33.489+0000", "status": 404, "error": "Not Found", "message": "No message available", "path": "/customer/000000000/orders" } this is the log I am getting in the app 2020-03-03 16:59:27.595 INFO 10406 --- [ main] c.f.m.orderhistory.Application : Starting Application on debian-sgtechedge with PID 10406 (/home/sergeygerodes/projects/scporderhistoryservice/build/classes/java/main started by sgerodes in /home/sergeygerodes/projects/scporderhistoryservice) 2020-03-03 16:59:27.602 INFO 10406 --- [ main] c.f.m.orderhistory.Application : No active profile set, falling back to default profiles: default 2020-03-03 16:59:28.414 INFO 10406 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2020-03-03 16:59:28.441 INFO 10406 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16ms. Found 0 JPA repository interfaces. 2020-03-03 16:59:28.768 INFO 10406 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2020-03-03 16:59:29.035 INFO 10406 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2020-03-03 16:59:29.046 INFO 10406 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-03-03 16:59:29.047 INFO 10406 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.29] 2020-03-03 16:59:29.140 INFO 10406 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2020-03-03 16:59:29.140 INFO 10406 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1475 ms 2020-03-03 16:59:29.294 INFO 10406 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2020-03-03 16:59:29.405 INFO 10406 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2020-03-03 16:59:29.424 INFO 10406 --- [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:orderhistory' 2020-03-03 16:59:29.517 INFO 10406 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2020-03-03 16:59:29.565 INFO 10406 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.4.9.Final} 2020-03-03 16:59:29.660 INFO 10406 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 2020-03-03 16:59:29.741 INFO 10406 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2020-03-03 16:59:29.886 INFO 10406 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2020-03-03 16:59:29.892 INFO 10406 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2020-03-03 17:00:28.614 WARN 10406 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=59s108ms538?s586ns). 2020-03-03 17:00:28.685 WARN 10406 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2020-03-03 17:00:28.845 INFO 10406 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-03-03 17:00:29.052 INFO 10406 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2020-03-03 17:00:29.060 INFO 10406 --- [ main] c.f.m.orderhistory.Application : Started Application in 61.937 seconds (JVM running for 62.493) 2020-03-03 17:00:33.395 INFO 10406 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2020-03-03 17:00:33.395 INFO 10406 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2020-03-03 17:00:33.404 INFO 10406 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 9 ms the whole applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="loggerService" class="com.fressnapf.sdk.logger.service.impl.DefaultLogService" /> <bean id="dataService" class="com.fressnapf.sdk.dataaccess.services.impl.H2DataProvider"> <constructor-arg index="0" value="${spring.datasource.url}"/> <constructor-arg index="1" value="${spring.datasource.username}"/> <constructor-arg index="2" value="${spring.datasource.password}"/> </bean> </beans>
If you copied your controller code and pasted it here... There is a close bracket too much. I tested it on one of my controllers and it shows the same behaviour. #RequestMapping(value = "/{customerid}/orders-->}<--"...
Query language problem with JPA +Hibernate+Mysql
I have developed a java stand alone application (java+hibernate) , now I am replanting which to java 8+springboot+jpa+hibernate+mysql framework. I used HQL in my old project, but there seems to be some problems with SQL sentences in the new framework , for example, I have to change "From p where id=(:parameter)" to "Select * from p where id=:parameter" by removing the bracket. BEAN #Entity public class Place extends Groupunit_Defined implements Interface_Entity { ...... #ManyToOne(targetEntity=Place_Definer.class) #JoinColumn(name="Groupunit_Definer",nullable=false) private Place_Definer Groupunit_Definer;// ..... } #Entity public class Place_Definer extends Groupunit_Definer { ...... #Column(nullable=false,length=150) private String Classification; ……. } #SuppressWarnings("unchecked") public ArrayList Simply_get_thing_list ( String Query_String, ArrayList Parameter_List, Class Thing_Class ) { Query q=Entity_Manager.createNativeQuery(Query_String,Thing_Class); ……. return Thing_List; } SQL SENTENCE "SELECT * FROM Place p WHERE p.Groupunit_Definer.Classification='Jurisdiction'" HIBERNATE CONFIG spring.jpa.database = MYSQL spring.jpa.show-sql = true spring.jpa.hibernate.ddl-auto = update spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect ERROR MESSAGE :: Spring Boot :: (v1.5.21.RELEASE) 2019-09-04 05:28:11.851 INFO 2508 --- [ main] c.s.mirrorworld.mirrorworldApplication : Starting mirrorworldApplication on LAPTOP-FAS0SHLM with PID 2508 (C:\Users\yueho\eclipse-workspace\mirrorworld\target\classes started by yueho in C:\Users\yueho\eclipse-workspace\mirrorworld) 2019-09-04 05:28:11.859 INFO 2508 --- [ main] c.s.mirrorworld.mirrorworldApplication : No active profile set, falling back to default profiles: default 2019-09-04 05:28:12.066 INFO 2508 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#2f217633: startup date [Wed Sep 04 05:28:12 CST 2019]; root of context hierarchy 2019-09-04 05:28:15.937 INFO 2508 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2019-09-04 05:28:15.994 INFO 2508 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2019-09-04 05:28:16.257 INFO 2508 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final} 2019-09-04 05:28:16.260 INFO 2508 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2019-09-04 05:28:16.263 INFO 2508 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2019-09-04 05:28:16.559 INFO 2508 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2019-09-04 05:28:17.740 INFO 2508 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 2019-09-04 05:28:19.002 WARN 2508 --- [ main] o.h.b.i.SessionFactoryBuilderImpl : Unrecognized hbm2ddl_auto value : update . Supported values include create, create-drop, update, and validate. Ignoring 2019-09-04 05:28:20.031 INFO 2508 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2019-09-04 05:28:24.577 INFO 2508 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2019-09-04 05:28:24.607 INFO 2508 --- [ main] c.s.mirrorworld.mirrorworldApplication : Started mirrorworldApplication in 13.439 seconds (JVM running for 24.733) 2019-09-04 05:28:33.326 INFO 2508 --- [WT-EventQueue-0] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory 2019-09-04 05:28:33.844 WARN 2508 --- [WT-EventQueue-0] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1054, SQLState: 42S22 2019-09-04 05:28:33.845 ERROR 2508 --- [WT-EventQueue-0] o.h.engine.jdbc.spi.SqlExceptionHelper : Unknown column 'p.Groupunit_Definer.Classification' in 'where clause' Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet at …… org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:375) at …… Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet at …... Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'p.Groupunit_Definer.Classification' in 'where clause'
The problem has been solved by changing "createNativeQuery" to "createQuery", thank you to
Spring boot with two datasources
I'm trying to set up a spring boot project with two datasources. one for loading and one for storing. application prop. # Primary DataSource datasource.primary.url=url datasource.primary.username=root datasource.primary.password=password datasource.primary.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver # Secondary DataSource datasource.secondary.url=url datasource.secondary.username=root datasource.secondary.password=password datasource.secondary.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver configuration class for primary db package com.anders.cphbusiness.db; import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.persistence.PersistenceContext; import javax.sql.DataSource; #Configuration #EnableTransactionManagement #EnableJpaRepositories(basePackages = "com.anders.cphbusiness.entitiesModel", entityManagerFactoryRef = "entityManager") public class LoadDataSourceConfig { #Bean(name = "dataSource") #Primary #ConfigurationProperties(prefix = "datasource.primary") public DataSource loadingDataSource() { return DataSourceBuilder.create().build(); } #PersistenceContext(unitName = "primary") #Primary #Bean(name = "entityManager") public LocalContainerEntityManagerFactoryBean loadingEntityManagerFactory(EntityManagerFactoryBuilder builder) { return builder.dataSource(loadingDataSource()).persistenceUnit("primary").packages("com.anders.cphbusiness.entitiesModel").build(); } } configuration class for secondary db package com.anders.cphbusiness.db; import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.persistence.PersistenceContext; import javax.sql.DataSource; #Configuration #EnableTransactionManagement #EnableJpaRepositories(basePackages = "com.anders.cphbusiness.storingModel", entityManagerFactoryRef = "secondaryEntityManager", transactionManagerRef = "secondaryTransactionManager") public class StoreDataSourceConfig { #Bean #ConfigurationProperties(prefix = "datasource.secondary") public DataSource storingDataSource() { return DataSourceBuilder.create().build(); } #PersistenceContext(unitName = "secondary") #Bean(name = "secondaryEntityManager") public LocalContainerEntityManagerFactoryBean storingEntityManagerFactory( EntityManagerFactoryBuilder builder) { return builder .dataSource(storingDataSource()) .packages("com.anders.cphbusiness.storingModel") .persistenceUnit("secondary") .build(); } #Bean(name = "secondaryTransactionManager") public PlatformTransactionManager transactionManager(EntityManagerFactoryBuilder builder) { JpaTransactionManager tm = new JpaTransactionManager(); tm.setEntityManagerFactory(storingEntityManagerFactory(builder).getObject()); tm.setDataSource(storingDataSource()); return tm; } } my repo in controller that it's complaining about. #Autowired private wagerBoardMarksRepo repo; the actual repo package com.anders.cphbusiness.repositories; import com.anders.cphbusiness.entitiesModel.WagerBoard; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; #Repository public interface WagerBoardRepo extends JpaRepository<WagerBoard, String> { } error : 2017-02-02 15:19:53.035 INFO 6804 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2017-02-02 15:19:53.035 INFO 6804 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.11 2017-02-02 15:19:53.172 INFO 6804 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2017-02-02 15:19:53.172 INFO 6804 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3048 ms 2017-02-02 15:19:53.452 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2017-02-02 15:19:53.462 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*] 2017-02-02 15:19:53.462 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2017-02-02 15:19:53.462 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2017-02-02 15:19:53.462 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2017-02-02 15:19:53.462 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2017-02-02 15:19:53.462 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*] 2017-02-02 15:19:53.462 INFO 6804 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*] 2017-02-02 15:19:56.837 INFO 6804 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'primary' 2017-02-02 15:19:56.857 INFO 6804 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: primary ...] 2017-02-02 15:19:57.008 INFO 6804 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final} 2017-02-02 15:19:57.009 INFO 6804 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2017-02-02 15:19:57.011 INFO 6804 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2017-02-02 15:19:57.071 INFO 6804 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2017-02-02 15:19:57.185 INFO 6804 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect 2017-02-02 15:19:57.666 WARN 6804 --- [ main] org.hibernate.mapping.RootClass : HHH000038: Composite-id class does not override equals(): com.anders.cphbusiness.entitiesModel.PK_poolgameTransaction 2017-02-02 15:19:57.667 WARN 6804 --- [ main] org.hibernate.mapping.RootClass : HHH000039: Composite-id class does not override hashCode(): com.anders.cphbusiness.entitiesModel.PK_poolgameTransaction 2017-02-02 15:19:57.667 WARN 6804 --- [ main] org.hibernate.mapping.RootClass : HHH000038: Composite-id class does not override equals(): com.anders.cphbusiness.entitiesModel.PK_WagerBoardMarks 2017-02-02 15:19:57.667 WARN 6804 --- [ main] org.hibernate.mapping.RootClass : HHH000039: Composite-id class does not override hashCode(): com.anders.cphbusiness.entitiesModel.PK_WagerBoardMarks 2017-02-02 15:19:57.668 WARN 6804 --- [ main] org.hibernate.mapping.RootClass : HHH000038: Composite-id class does not override equals(): com.anders.cphbusiness.entitiesModel.PK_wagerBoard 2017-02-02 15:19:57.668 WARN 6804 --- [ main] org.hibernate.mapping.RootClass : HHH000039: Composite-id class does not override hashCode(): com.anders.cphbusiness.entitiesModel.PK_wagerBoard 2017-02-02 15:19:58.050 INFO 6804 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'primary' 2017-02-02 15:19:58.090 INFO 6804 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'secondary' 2017-02-02 15:19:58.090 INFO 6804 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: secondary ...] 2017-02-02 15:20:00.790 INFO 6804 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect 2017-02-02 15:20:00.962 INFO 6804 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'secondary' 2017-02-02 15:20:00.982 WARN 6804 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'restController': Unsatisfied dependency expressed through field 'repo'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.anders.cphbusiness.repositories.wagerBoardMarksRepo' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true), #org.springframework.beans.factory.annotation.Qualifier(value=wagerRepo)} 2017-02-02 15:20:00.982 INFO 6804 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'secondary' 2017-02-02 15:20:00.982 INFO 6804 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'primary' 2017-02-02 15:20:01.002 INFO 6804 --- [ main] utoConfigurationReportLoggingInitializer : Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2017-02-02 15:20:01.152 ERROR 6804 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Field repo in com.anders.cphbusiness.controller.restController required a bean of type 'com.anders.cphbusiness.repositories.wagerBoardMarksRepo' that could not be found. Action: Consider defining a bean of type 'com.anders.cphbusiness.repositories.wagerBoardMarksRepo' in your configuration. tried to follow the example at http://docs.spring.io/spring-boot/docs/current/reference/html/howto-data-access.html#howto-use-two-entity-managers Any suggestions - hints - guides for setting up spring boot with multiple datasources (preferable a working git with project the utilize two datasources)
Spring boot jpa with H2 database
I am trying a sample code to run my Spring Boot data project with JPA for an H2 DB. The code is below, application is running properly, but I don't see any table getting created, I don't see any error in the server console as well. I checked the logs, I don't see any queries getting created an fired. Am I am doing anything wrong? Domain class: #Entity public class Account { #Id #GeneratedValue private Integer accountId; private String name; private String accType; public Integer getAccountId() { return accountId; } public String getName() { return name; } public String getAccType() { return accType; } public Account(Integer accountId, String name, String accType) { super(); this.accountId = accountId; this.name = name; this.accType = accType; } public Account(String name, String accType) { super(); this.name = name; this.accType = accType; } public Account() { } Data Loader class: #Component public class AccountLoaded { private AccountRepository accountRepository; public AccountLoaded(AccountRepository accountRepository) { this.accountRepository = accountRepository; } #PostConstruct private void loadData() { Account account = new Account(1,"Madhu","Savings"); accountRepository.save(account); System.out.println("Loaded Account " + account.toString()); } } Repository class: #Repository public interface AccountRepository extends CrudRepository<Account, Integer> { } application.properties: spring.datasource.jdbc-url=jdbc:h2:mem:test spring.h2.console.enabled=true spring.h2.console.path=/console spring.datasource.platform=h2 My Logs in the server console: 2016-10-11 12:38:26.202 INFO 20020 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2016-10-11 12:38:26.217 INFO 20020 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2016-10-11 12:38:26.285 INFO 20020 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final} 2016-10-11 12:38:26.287 INFO 20020 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2016-10-11 12:38:26.288 INFO 20020 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2016-10-11 12:38:26.327 INFO 20020 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2016-10-11 12:38:26.554 INFO 20020 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2016-10-11 12:38:26.995 INFO 20020 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export 2016-10-11 12:38:27.004 INFO 20020 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete 2016-10-11 12:38:27.044 INFO 20020 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' Loaded Account Account [accountId=1, name=Madhu, accType=Savings] 2016-10-11 12:38:27.587 INFO 20020 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#b472aa: startup date [Tue Oct 11 12:38:23 CDT 2016]; root of context hierarchy 2016-10-11 12:38:27.663 INFO 20020 --- [ 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-10-11 12:38:27.664 INFO 20020 --- [ 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-10-11 12:38:27.696 INFO 20020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-10-11 12:38:27.696 INFO 20020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-10-11 12:38:27.732 INFO 20020 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-10-11 12:38:27.959 INFO 20020 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2016-10-11 12:38:28.011 INFO 20020 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2016-10-11 12:38:28.015 INFO 20020 --- [ main] com.example.SpringdataApplication : Started SpringdataApplication in 4.898 seconds (JVM running for 5.255)
Change spring.datasource.jdbc-url=jdbc:h2:mem:test to spring.datasource.jdbc-url=jdbc:h2:file:test (test is the name of the db file, could also have a path with the name) and use one of these tools to view the DB. You can also log the SQL statements to your console, by adding spring.jpa.show-sql: true to your application.properties
If you go to the embedded h2 console (http://localhost:8080/console), and there type the correct connection URL (jdbc:h2:mem:test), you should see things. The embedded h2 console does not show the correct connection URL by default, it forgets the :mem: part IIRC.
Even if all is done in memory you should see SQL logs when spring.jpa.show-sql is set to true (in application.properties file). Don't forget to set spring.jpa.generate-ddl to true ( default is false) and make you loadData method transaction (see Spring #Transactional annotation).
Spring Boot Failing to Start Correctly [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 years ago. Improve this question My Spring Boot application is failing at startup, with the log below. What does this mean? I'm using Hibernate Core v5.0.11.Final. <pre> . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.4.1.RELEASE) 2016-09-27 02:55:31.899 INFO 5329 --- [ main] c.t.application.TaqnihomeApplication : Starting TaqnihomeApplication on Songlines-MacBook-Air.local with PID 5329 (/Users/songline/Downloads/assignment-2/target/classes started by songline in /Users/songline/Downloads/assignment-2) 2016-09-27 02:55:31.904 INFO 5329 --- [ main] c.t.application.TaqnihomeApplication : No active profile set, falling back to default profiles: default 2016-09-27 02:55:32.092 INFO 5329 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#7722c3c3: startup date [Tue Sep 27 02:55:32 IST 2016]; root of context hierarchy 2016-09-27 02:55:33.792 INFO 5329 --- [ 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$Generic; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Generic.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$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] 2016-09-27 02:55:34.412 INFO 5329 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8ec63a75] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-09-27 02:55:35.085 INFO 5329 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2016-09-27 02:55:35.103 INFO 5329 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2016-09-27 02:55:35.104 INFO 5329 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5 2016-09-27 02:55:35.280 INFO 5329 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2016-09-27 02:55:35.280 INFO 5329 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3192 ms 2016-09-27 02:55:35.492 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2016-09-27 02:55:35.497 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2016-09-27 02:55:35.498 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2016-09-27 02:55:35.498 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2016-09-27 02:55:35.498 INFO 5329 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2016-09-27 02:55:35.798 INFO 5329 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2016-09-27 02:55:35.818 INFO 5329 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2016-09-27 02:55:35.917 INFO 5329 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final} 2016-09-27 02:55:35.919 INFO 5329 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2016-09-27 02:55:35.921 INFO 5329 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2016-09-27 02:55:35.990 INFO 5329 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2016-09-27 02:55:36.268 INFO 5329 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Started. 2016-09-27 02:55:36.528 INFO 5329 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 2016-09-27 02:55:37.223 INFO 5329 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update 2016-09-27 02:55:37.266 INFO 5329 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: game_library 2016-09-27 02:55:37.363 WARN 5329 --- [ 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 2016-09-27 02:55:37.364 INFO 5329 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Close initiated... 2016-09-27 02:55:37.370 INFO 5329 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Closed. 2016-09-27 02:55:37.372 INFO 5329 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2016-09-27 02:55:37.390 INFO 5329 --- [ main] utoConfigurationReportLoggingInitializer : Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2016-09-27 02:55:37.398 ERROR 5329 --- [ 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: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.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851) ~[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.taqnihome.application.TaqnihomeApplication.main(TaqnihomeApplication.java:34) [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.11.Final.jar:5.0.11.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:373) ~[spring-orm-4.3.3.RELEASE.jar:4.3.3.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:362) ~[spring-orm-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] ... 16 common frames omitted Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to execute schema management to JDBC target [alter table game_library add column game_id varchar(255) not null] at org.hibernate.tool.schema.internal.TargetDatabaseImpl.accept(TargetDatabaseImpl.java:59) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:431) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:449) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.tool.schema.internal.SchemaMigratorImpl.migrateTable(SchemaMigratorImpl.java:253) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigrationToTargets(SchemaMigratorImpl.java:170) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:60) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:134) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:472) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final] ... 22 common frames omitted Caused by: java.sql.SQLSyntaxErrorException: Table 'testingjpa.game_library' doesn't exist at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:686) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:663) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:653) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2041) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1608) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2630) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1534) ~[mysql-connector-java-6.0.3.jar:6.0.3] at com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:120) ~[HikariCP-2.4.7.jar:na] at com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java) ~[HikariCP-2.4.7.jar:na] at org.hibernate.tool.schema.internal.TargetDatabaseImpl.accept(TargetDatabaseImpl.java:56) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final] ... 32 common frames omitted </pre> Log TLDR; HHH000228: Running hbm2ddl schema update HHH000262: Table not found: game_library GameLibrary class: #Entity #Table(name = "game_library") public class GameLibrary { #Id #Column(name = "game_id") private String gameId; #Column(name = "game_name") private String gameName; #Column(name = "game_genre") private String gameGenre; #ManyToOne #JoinColumn(name = "game_category", nullable = false) private GameCategory gameCategory; #Column(name = "game_version") private String gameVersion; #Column(name = "game_publiher") private String gamePublisher; #Column(name = "game_studio") private String gameStudio; #Column(name = "game_release_date") private Long gameReleaseDate; #Column private Double gameRating; #Column private String gamePlatform; #Column private Long creationDate; #Column private String googlePlayUrl; #Column private Long approvedDate; #Column private Boolean isApproved; #Column private String packageName; #ManyToMany(mappedBy = "gameLibrary", cascade = CascadeType.ALL) private List<GameProfile> gameProfiles; // getters and setters } new log when update change with create field value ddl-auto . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.4.1.RELEASE) 2016-09-27 12:47:50.815 INFO 5812 --- [ main] c.t.application.TaqnihomeApplication : Starting TaqnihomeApplication on Songlines-MacBook-Air.local with PID 5812 (/Users/songline/Downloads/assignment-2/target/classes started by songline in /Users/songline/Downloads/assignment-2) 2016-09-27 12:47:50.818 INFO 5812 --- [ main] c.t.application.TaqnihomeApplication : No active profile set, falling back to default profiles: default 2016-09-27 12:47:50.939 INFO 5812 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#7722c3c3: startup date [Tue Sep 27 12:47:50 IST 2016]; root of context hierarchy 2016-09-27 12:47:52.624 INFO 5812 --- [ 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$Generic; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Generic.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$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] 2016-09-27 12:47:53.213 INFO 5812 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8ec63a75] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-09-27 12:47:53.853 INFO 5812 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2016-09-27 12:47:53.874 INFO 5812 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2016-09-27 12:47:53.876 INFO 5812 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5 2016-09-27 12:47:54.085 INFO 5812 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2016-09-27 12:47:54.085 INFO 5812 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3153 ms 2016-09-27 12:47:54.275 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2016-09-27 12:47:54.281 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2016-09-27 12:47:54.281 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2016-09-27 12:47:54.282 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2016-09-27 12:47:54.282 INFO 5812 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2016-09-27 12:47:54.529 INFO 5812 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2016-09-27 12:47:54.552 INFO 5812 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2016-09-27 12:47:54.640 INFO 5812 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final} 2016-09-27 12:47:54.642 INFO 5812 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2016-09-27 12:47:54.644 INFO 5812 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2016-09-27 12:47:54.691 INFO 5812 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2016-09-27 12:47:54.965 INFO 5812 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Started. 2016-09-27 12:47:55.253 INFO 5812 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 2016-09-27 12:47:56.049 INFO 5812 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export 2016-09-27 12:47:56.441 INFO 5812 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete 2016-09-27 12:47:56.489 INFO 5812 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2016-09-27 12:47:57.575 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/login],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.login(com.taqnihome.domain.User) 2016-09-27 12:47:57.577 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/signup],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.saveData(com.taqnihome.domain.User) 2016-09-27 12:47:57.577 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/search],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.checkMacAddress(com.taqnihome.domain.User) 2016-09-27 12:47:57.577 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addGameToProfile],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.addGameToProfile(com.taqnihome.domain.GameProfile) 2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/updateGameToProfile],methods=[PUT]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.updateGameToProfile(com.taqnihome.domain.GameProfile) 2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addGameRequestToLibrary],methods=[POST]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.addGameRequestToLibrary(java.lang.String,java.lang.String) 2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/getAllLibraryGames],methods=[GET]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.getAllGames() 2016-09-27 12:47:57.578 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/getGameProfileByUser],methods=[GET]}" onto public org.springframework.http.ResponseEntity com.taqnihome.controller.HomeController.getAllProfileGames(com.taqnihome.domain.User) 2016-09-27 12:47:57.579 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v2/api-docs],methods=[GET],produces=[application/json || application/hal+json]}" onto public org.springframework.http.ResponseEntity springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest) 2016-09-27 12:47:57.584 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/ui]}" onto org.springframework.http.ResponseEntity springfox.documentation.swagger.web.ApiResourceController.uiConfiguration() 2016-09-27 12:47:57.590 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/security]}" onto org.springframework.http.ResponseEntity springfox.documentation.swagger.web.ApiResourceController.securityConfiguration() 2016-09-27 12:47:57.591 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources]}" onto org.springframework.http.ResponseEntity> springfox.documentation.swagger.web.ApiResourceController.swaggerResources() 2016-09-27 12:47:57.595 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2016-09-27 12:47:57.595 INFO 5812 --- [ 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-09-27 12:47:57.914 INFO 5812 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#7722c3c3: startup date [Tue Sep 27 12:47:50 IST 2016]; root of context hierarchy 2016-09-27 12:47:58.017 INFO 5812 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-09-27 12:47:58.017 INFO 5812 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-09-27 12:47:58.068 INFO 5812 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-09-27 12:47:58.430 INFO 5812 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2016-09-27 12:47:58.437 INFO 5812 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure 2016-09-27 12:47:58.443 INFO 5812 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource] 2016-09-27 12:47:58.449 INFO 5812 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647 2016-09-27 12:47:58.449 INFO 5812 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed 2016-09-27 12:47:58.476 INFO 5812 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s) 2016-09-27 12:47:58.487 INFO 5812 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references 2016-09-27 12:47:58.843 INFO 5812 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2016-09-27 12:47:58.850 INFO 5812 --- [ main] c.t.application.TaqnihomeApplication : Started TaqnihomeApplication in 8.563 seconds (JVM running for 8.995)
Hibernate is pitching a fit because you told it to do this (intentionally or not): alter table game_library add column game_id varchar(255) not null However, Table 'testingjpa.game_library' doesn't exist. Either fix your DB or fix your game_library object definition or mapping. It's probably gone from your DB, or you're pointing it at a wrong or older DB.
Have a look at the error message that Hibernate is providing you: java.sql.SQLSyntaxErrorException: Table 'testingjpa.game_library' doesn't exist You're referring to a table that doesn't yet exist in your database, or that your DB user does not have access to. This is causing Spring to fail when it's setting up your Entity Manager Factory, and ultimately the entire Spring context. The errant SQL statement seems to be: alter table game_library add column game_id varchar(255) not null If this is in a schema.sql file, or some other schema configuration file that you're running to setup your database, you'll have to ensure that the table is created correctly before you run this alter statement. Have a look at the Spring Boot doc on Database initialization. If you're expecting the table to be auto-generated, ensure that you have the spring.jpa.generate-ddl flag set to true in your application.properties file.