gpt4 book ai didi

mysql - 在JBoss上部署spring应用程序时出错

转载 作者:行者123 更新时间:2023-11-29 19:37:39 28 4
gpt4 key购买 nike

当我尝试在 jboss 上运行我的应用程序时,我收到以下堆栈跟踪,我的应用程序在应用程序启动时需要数据库连接,我正在使用hibernate、spring集成,并且我的数据库是<强>mysql。我的数据库详细信息正确。我有什么遗漏的吗?

 2017-01-06 12:12:23,933 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 70) MSC000001: 
Failed to start service jboss.undertow.deployment.default-server.default-host./ZealWay:
org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./ZealWay:
java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'webController': Unsatisfied dependency expressed through field 'transactionManagerService':
Error creating bean with name 'transactionManagerServiceImpl': Unsatisfied dependency expressed through field 'gatewayFacade':
Error creating bean with name 'gatewayFacade': Unsatisfied dependency expressed through field 'gatewayRouter':
Error creating bean with name 'gatewayRouterImpl': Unsatisfied dependency expressed through field 'gatewayAquirers':
Error creating bean with name 'gatewayAquirers' defined in class path resource [com/iz/zw/configuration/GatewayAquirerConfig.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [java.util.HashMap]: Factory method 'gatewayAquirers' threw exception;
nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction;
nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection;

数据源配置代码

@Bean
public DataSource dataSource() throws IllegalStateException, PropertyVetoException {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
dataSource.setDriverClass(environment.getRequiredProperty("jdbc.driverClassName"));
dataSource.setJdbcUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUser(environment.getRequiredProperty("jdbc.username"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
dataSource.setInitialPoolSize(Integer.parseInt(environment.getProperty("jdbc.initial.pool.size")));
dataSource.setMinPoolSize(Integer.parseInt(environment.getProperty("jdbc.min.pool.size")));
dataSource.setMaxPoolSize(Integer.parseInt(environment.getProperty("jdbc.max.pool.size")));
return dataSource;
}

最佳答案

在您的 GatewayAquirerConfig 中,您尚未定义 bean gatewayAquirers。您可能有:

@Autowired
GatewayAquirers gatewayAquirers;

GatewayAquirers 之外的某个地方没有 @Component 或 @Service,或者没有在包扫描中被拾取。

关于mysql - 在JBoss上部署spring应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41500850/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com