关于activiti-ui改造无法启动
来源:9-14 工作流平台搭建-购物流程-3
weixin_慕妹1504304
2020-12-14
老师您好!
在视频9-4和9-5 activiti工作流搭建集成springboot 中,在整合activiti-ui中,出现视频之外的启动问题
将视频中的需要修改的地方修改后
1.查看了您回答某位某位同学的问题,添加了该注解
https://coding.imooc.com/learn/questiondetail/64432.html
@Import({ApplicationConfiguration.class})
@EntityScan({ "org.activiti.app.domain" })
@SpringBootApplication
public class ActivitiUIApplication extends SpringBootServletInitializer {
}
- 并且禁用了hibernate的二级缓存
spring:
freemarker:
check-template-location: false
jpa:
properties:
hibernate:
cache:
use_second_level_cache: fasle
3.根据stackoverflow.的意见修改了源码
https://stackoverflow.com/questions/29715863/spring-boot-rest-app-on-gae-throws-an-exception-cannot-be-cast-to-javax-persiste
@Bean(name = "transactionManager")
public PlatformTransactionManager annotationDrivenTransactionManager() {
JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
// 这里改变代码 =》 entityManagerFactory().getObject()
jpaTransactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return jpaTransactionManager;
}
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
log.info("Configuring EntityManager");
LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean();
lcemfb.setPersistenceProvider(new HibernatePersistence());
lcemfb.setPersistenceUnitName("persistenceUnit");
lcemfb.setDataSource(dataSource());
lcemfb.setJpaDialect(new HibernateJpaDialect());
lcemfb.setJpaVendorAdapter(jpaVendorAdapter());
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.cache.use_second_level_cache", false);
jpaProperties.put("hibernate.generate_statistics", env.getProperty("hibernate.generate_statistics", Boolean.class, false));
lcemfb.setJpaProperties(jpaProperties);
lcemfb.setPackagesToScan("org.activiti.app.domain");
lcemfb.afterPropertiesSet();
// 这里改变了返回类型
return lcemfb;
}
程序启动仍然报错(只展示一部分错误信息):
HHH000389: Unsuccessful: alter table act_de_model_relation drop constraint FK_besnrvpb967gxle32i64gqlnu o.h.t.h.SchemaExport.perform:425
Table “ACT_DE_MODEL_RELATION” not found; SQL statement:
HHH000389: Unsuccessful: alter table act_de_model_relation drop constraint FK_3xctj1ktlr9dpff4n0ct3t2a1 o.h.t.h.SchemaExport.perform:425
Table “ACT_DE_MODEL_RELATION” not found; SQL statement:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dbAuthenticationProvider’ defined in class path resource [org/activiti/app/conf/SecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.authentication.AuthenticationProvider]: Circular reference involving containing bean ‘securityConfiguration’ - consider declaring the factory method as static for independence from its containing instance. Factory method ‘dbAuthenticationProvider’ threw exception; 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 org.activiti.app.service.api.UserCache org.activiti.app.security.UserDetailsService.userCache; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userCacheImpl’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.activiti.engine.IdentityService org.activiti.app.service.idm.UserCacheImpl.identityService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘activitiEngineConfiguration’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.transaction.PlatformTransactionManager org.activiti.app.conf.ActivitiEngineConfiguration.transactionManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’ defined in class path resource [org/activiti/app/conf/DatabaseConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.PlatformTransactionManager]: Factory method ‘annotationDrivenTransactionManager’ threw exception; nested exception is java.lang.ClassCastException: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBeanEnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIBb3a384b9 cannot be cast to javax.persistence.EntityManagerFactory
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.activiti.app.security.CustomUserDetailService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException (DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency (DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency (DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject (AutowiredAnnotationBeanPostProcessor.java:533)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject (InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues (AutowiredAnnotationBeanPostProcessor.java:331)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:476)
我看了下问答,有很多学员在这部分和我一样遇到了这些问题,但是教学视频中似乎没有提到,我按照有些学院提供的解决方案,但是不起效果,老师这个报错要如何解决?
1回答
-
Jimmy
2021-02-25
HHH000389: Unsuccessful: alter table act_de_model_relation drop constraint FK_besnrvpb967gxle32i64gqlnu o.h.t.h.SchemaExport.perform:425
Table “ACT_DE_MODEL_RELATION” not found; SQL statement:HHH000389: Unsuccessful: alter table act_de_model_relation drop constraint FK_3xctj1ktlr9dpff4n0ct3t2a1 o.h.t.h.SchemaExport.perform:425
Table “ACT_DE_MODEL_RELATION” not found; SQL statement:根据这个提示,hibernate创建表结构的时候失败了,建议创建一个新的数据库,重新启动执行
00
相似问题