为什么不连接到数据库 mysql 如果在 jelastic 托管中,如果在 eclipse 中正常?

why not connect to database mysql if in jelastic hosting,and if in eclipse normal?

留言

Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"

    xmlns:mvc="http://www.springframework.org/schema/mvc" 

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans.xsd

        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx.xsd">

    <context:component-scan base-package="com.hendri" />

    <!-- Enables the Spring MVC @Controller programming model -->
    <mvc:annotation-driven />

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving 
        up static resources in the ${webappRoot}/resources directory -->

    <!--  <mvc:resources mapping="/resources/**" location="/resources/"/> -->
        <mvc:resources mapping="/images/**" location="/images/"/>
        <mvc:resources mapping="/bukanadmin/**" location="/bukanadmin/"/>
        <mvc:resources mapping="/resources/**" location="/resources/"/>





    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.tiles3.TilesViewResolver">

        <property name="viewClass"
            value="org.springframework.web.servlet.view.tiles3.TilesView" />
    </bean>

    <bean id="tilesConfigurer"
        class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/layouts/layouts.xml</value>
            </list>
        </property>
    </bean>

    <bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="messages" />
    </bean>
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
    <!-- Root Context: defines shared resources visible to all other web components -->

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">

        <property name="url" value="jdbc:mysql://mysql3309-testaja.kilatiron.com:3306/sms" />       
        <property name="username" value="root" />
        <property name="password" value="somepassword" />
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>



    </bean>





    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />



        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
            </props>
        </property>
        <property name="packagesToScan" value="com.hendri.domain" />
    </bean>

    <tx:annotation-driven />

    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>



</beans>

Tomcat 提供内存泄漏检测功能,当 webapp 的 /WEB-INF/lib 中有一个 JDBC 4.0 兼容驱动程序时,它会在 webapp 启动期间使用 ServiceLoader API,但它在 webapp 关闭期间没有自动注销自身。 您可以将 JDBC driver 移动到 Tomcat 的 /lib 文件夹 (/opt/tomcat/lib) 并使用连接池数据源来管理驱动程序。

请注意 Tomcat 的内置 DBCP 不会在关闭时正确注销驱动程序。

另请参阅错误 DBCP-322