讨论区 » AAS-V10企业版 »
V10部署报错
项目:深圳住建局
报错内容:(前端页面部署后黄框报错内容如下,后台无明显报错)
Error occurred during deployment: : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shirFilter' defined in class path resource [com/javaweb/system/config/ShiroConfig.class]: Unsatisfied dependency expressed through method 'shirFilter' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [com/javaweb/system/config/ShiroConfig.clas .... msg.seeServerLog
主要问题:No qualifying bean of type 'org.springframework.jdbc.datasource.DataSourceTransactionManager' available: expected at least 1 bean which qualifies as autowire candidate.
根因:springboot如果没有显式配置数据源事务类型会启动自动加载机制,如果没有扫描到jta相关的包,就默认用DataSourceTransactionManager(这个是你们应用需要的),但是由于我们V10本身带有jta的包,导致springboot误设置为Jta事务管理器,导致异常
解决办法:
解决一:将附件apusic-web.xml放进应用包WEB-INF目录下
解决二:禁止springboot扫描jta的包
@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration.class}) 排除 JtaAutoConfiguration 自动转配
解决三:显式设置事务管理器为DataSourceTransactionManager
@Configuration(
proxyBeanMethods = false)
@AutoConfigureOrder(0)
@EnableConfigurationProperties({DataSourceProperties.class{color}})
public class DataSourceTransactionManagerConfiguration {
public DataSourceTransactionManagerConfiguration() {
}
@Configuration(
proxyBeanMethods = false )
static class JdbcTransactionManagerConfiguration {
JdbcTransactionManagerConfiguration() {
}
@Bean DataSourceTransactionManager transactionManager(Environment environment, DataSource dataSource, ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
DataSourceTransactionManager transactionManager = this.createTransactionManager(environment, dataSource); transactionManagerCustomizers.ifAvailable((customizers) -> {
customizers.customize(transactionManager); }); return transactionManager; }
private DataSourceTransactionManager createTransactionManager(Environment environment, DataSource dataSource) {
return environment.getProperty("spring.dao.exceptiontranslation.enabled", Boolean.class, Boolean.TRUE) ? new JdbcTransactionManager(dataSource) : new DataSourceTransactionManager(dataSource); }
}
}
apusic-web.xml (274 Bytes) apusic-web.xml |