在JHipster项目的帮助下无法启动Spring Boot

时间:2016-04-03 18:02:03

标签: spring spring-boot jhipster

我在JHipster的帮助下创建了一个应用程序,在初始启动应用程序时很好。

创建自定义实体后,我遇到了2个问题

第一个问题:: 无法在类路径中找到下面给出的异常,但是通过清理项目已经清除了这个问题

c.m.s.c.liquibase.AsyncSpringLiquibase  [0;39m Liquibase could not start correctly, your database is NOT ready: liquibase.exception.SetupException: Error Reading Migration File: class path resource [config/liquibase/changelog/20160403132658_added_entity_School.xml] cannot be resolved to URL because it does not exist

liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Error Reading Migration File: class path resource [config/liquibase/changelog/20160403132658_added_entity_School.xml] cannot be resolved to URL because it does not exist
    at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27)
    at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:227)
    at liquibase.Liquibase.update(Liquibase.java:202)
    at liquibase.Liquibase.update(Liquibase.java:192)
    at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:434)
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:391)
    at com.masscom.school.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:66)
    at com.masscom.school.config.liquibase.AsyncSpringLiquibase.lambda$0(AsyncSpringLiquibase.java:49)
    at com.masscom.school.async.ExceptionHandlingAsyncTaskExecutor.lambda$1(ExceptionHandlingAsyncTaskExecutor.java:47)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: liquibase.exception.SetupException: Error Reading Migration File: class path resource [config/liquibase/changelog/20160403132658_added_entity_School.xml] cannot be resolved to URL because it does not exist
    at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:269)
    at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:230)
    at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25)
    ... 11 common frames omitted
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: class path resource [config/liquibase/changelog/20160403132658_added_entity_School.xml] cannot be resolved to URL because it does not exist
    at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:112)
    at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17)
    at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:404)
    at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:267)
    ... 13 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [config/liquibase/changelog/20160403132658_added_entity_School.xml] cannot be resolved to URL because it does not exist
    at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187)
    at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:164)
    at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:182)
    at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:93)
    ... 16 common frames omitted

36mcom.masscom.school.SchoolRegApp  [0;39m Running with Spring profile(s) : [dev]
[2m2016-04-03 19:46:15.678[0;39m [32mDEBUG[0;39m [35m8604[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [36mc.m.school.config.CacheConfiguration    [0;39m [2m:[0;39m Starting Ehcache
[2m2016-04-03 19:46:15.681[0;39m [32mDEBUG[0;39m [35m8604[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [36mc.m.school.config.CacheConfiguration    [0;39m [2m:[0;39m Registering Ehcache Metrics gauges
[2m2016-04-03 19:46:16.388[0;39m [32mDEBUG[0;39m [35m8604[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [36mc.m.s.c.apidoc.SwaggerConfiguration     [0;39m [2m:[0;39m Starting Swagger
[2m2016-04-03 19:46:16.404[0;39m [32mDEBUG[0;39m [35m8604[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [36mc.m.s.c.apidoc.SwaggerConfiguration     [0;39m [2m:[0;39m Started Swagger in 16 ms
[2m2016-04-03 19:46:18.139[0;39m [32m INFO[0;39m [35m8604[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [36mcom.masscom.school.SchoolRegApp         [0;39m [2m:[0;39m Started SchoolRegApp in 19.116 seconds (JVM running for 20.052)
[2m2016-04-03 19:46:18.146[0;39m [32m INFO[0;39m [35m8604[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [36mcom.masscom.school.SchoolRegApp         [0;39m [2m:[0;39m 
----------------------------------------------------------
    Application 'SchoolRegApp' is running! Access URLs:
    Local:      http://127.0.0.1:8080
    External:   http://192.168.0.105:8080
----------------------------------------------------------
[2m2016-04-03 19:48:20.199[0;39m [32mDEBUG[0;39m [35m8604[0;39m [2m---[0;39m [2m[nio-8080-exec-4][0;39m [36mc.m.school.aop.logging.LoggingAspect    [0;39m [2m:[0;39m Enter: org.springframework.boot.actuate.audit.AuditEventRepository.add() with argument[s] = [AuditEvent [timestamp=Sun Apr 03 19:48:20 IST 2016, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={type=org.springframework.security.access.AccessDeniedException, message=Access is denied}]]
[2m2016-04-03 19:48:20.200[0;39m [32mDEBUG[0;39m [35m8604[0;39m [2m---[0;39m [2m[nio-8080-exec-4][0;39m [36mc.m.school.aop.logging.LoggingAspect    [0;39m [2m:[0;39m Exit: org.springframework.boot.actuate.audit.AuditEventRepository.add() with result = null
[2m2016-04-03 19:48:20.215[0;39m [32mDEBUG[0;39m [35m8604[0;39m [2m---[0;39m [2m[nio-8080-exec-4][0;39m [36mc.m.s.s.Http401UnauthorizedEntryPoint   [0;39m [2m:[0;39m Pre-authenticated entry point called. Rejecting access

第二个问题::清理后现在我无法启动服务器,因为bean异常。

mc.m.s.c.liquibase.AsyncSpringLiquibase  [0;39m [2m:[0;39m Starting Liquibase asynchronously, your database might not be ready at startup!
mo.a.c.c.C.[Tomcat].[localhost].[/]      [0;39m [2m:[0;39m Exception starting filter springSecurityFilterChain

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.core.userdetails.UserDetailsService com.masscom.school.config.SecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.masscom.school.repository.UserRepository com.masscom.school.security.UserDetailsService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#668eb90d' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#668eb90d': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is 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.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)

我创建了三个实体,我已经给出了所有三个实体

1。家长2.学校3.学生

enter image description here

.yo-rc.json

enter image description here

有人可以帮我解决这个问题。

如有更多细节,请告诉我。

2 个答案:

答案 0 :(得分:1)

只需mvn liquibase:dropAll,清除所有数据库表,查看等等。

答案 1 :(得分:0)

由于一对一映射问题已得到解决。早期版本的JHipster不支持一对一映射。