【问题标题】:Error while Deployment of spring application on JBoss在 JBoss 上部署 Spring 应用程序时出错
【发布时间】:2017-01-06 07:19:10
【问题描述】:

当我试图在 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;
    }

【问题讨论】:

  • ` 无法获取 JDBC 连接;` : 数据库连接有问题。也许它只是没有通过 JNDI 正确暴露......

标签: mysql hibernate spring-integration


【解决方案1】:

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

@Autowired
GatewayAquirers gatewayAquirers;

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

【讨论】:

  • 但是当我在 Tomcat 上部署它时,它运行良好..!
  • JBoss 上的数据库连接是否正确?你如何连接到数据库?您的数据源配置。
  • 添加了我的数据源配置
猜你喜欢
  • 2012-04-23
  • 2012-04-18
  • 2020-03-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多