Spring / Hibernate应用程序在初始化期间挂起

时间:2015-12-25 11:48:42

标签: java mysql spring hibernate

Web应用程序在其他系统中部署。但是,它只是挂在我的系统中。

  • Java版本:jdk1.8
  • TomcatVersion:apache-tomcat-7.0.63
  • 春季版:4.1.6.RELEASE
  • Hibernate版本:4.3.5.Final
  • MySQL连接器:5.0.8.bin jar

请参阅下面的日志。

日志

[org.hibernate.dialect.Dialect] : [MySQL5] -> [org.hibernate.dialect.MySQL5Dialect] (replacing [org.hibernate.dialect.MySQL5Dialect])
[2014-01-14 13:44:25,537 main] [org.hibernate.boot.registry.selector.internal.StrategySelectorImpl : 79] [DEBUG] Registering named strategy selector [org.hibernate.dialect.Dialect] : [MySQL5InnoDB] -> [org.hibernate.dialect.MySQL5InnoDBDialect] (replacing [org.hibernate.dialect.MySQL5InnoDBDialect])
[2014-01-14 13:44:25,609 main] [org.hibernate.cfg.Configuration : 1841] [DEBUG] Preparing to build session factory with filters : {}
[2014-01-14 13:44:25,611 main] [org.hibernate.cfg.Configuration : 1841] [DEBUG] Preparing to build session factory with filters : {}

部署只是在此行之后像睡眠线程一样挂起。可能是什么问题?如果您需要更多信息,请告诉我

编辑1: 我已经通过Spring依赖注入配置了hibernate sessionfactory。请查看以下

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/mobile_recharge"/>
    <property name="username" value="keerthi" />
    <property name="password" value="keerthi" />
    <property name="maxIdle" value="-1"></property>
    <property name="maxActive" value="-1"></property>
    <property name="maxOpenPreparedStatements" value="-1"></property>
    <property name="maxWait" value="30000"></property>
    <property name="validationQuery" value="SELECT 1"></property>
    <property name="testOnBorrow" value="true"></property>
</bean>

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="com.ciar.mobilerecharge.model" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
            <prop key="hibernate.format_sql">true</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="use_sql_comments">true</prop>
        </props>
    </property>
</bean>

0 个答案:

没有答案