Java 弹簧&x2B;冬眠+;AWS RDS-当应用程序在tomcat 8上本地部署时,无法连接到AWS RDS

Java 弹簧&x2B;冬眠+;AWS RDS-当应用程序在tomcat 8上本地部署时,无法连接到AWS RDS,java,mysql,spring,hibernate,amazon-web-services,Java,Mysql,Spring,Hibernate,Amazon Web Services,我正在尝试使用部署在Tomcat8本地的spring应用程序连接到AWS RDS db(MySql)。当服务器启动时,我收到以下警告 2017年4月16日下午2:51:08 org.hibernate.engine.jdbc.internal.jdbcservicesiml configure 警告:HH000342:无法获取查询元数据的连接:无法创建PoolableConnectionFactory(通信链路故障。上次成功发送到服务器的数据包是0毫秒前的事。驱动程序尚未从服务器收到任何数据包。

我正在尝试使用部署在Tomcat8本地的spring应用程序连接到AWS RDS db(MySql)。当服务器启动时,我收到以下警告

2017年4月16日下午2:51:08 org.hibernate.engine.jdbc.internal.jdbcservicesiml configure 警告:HH000342:无法获取查询元数据的连接:无法创建PoolableConnectionFactory(通信链路故障。上次成功发送到服务器的数据包是0毫秒前的事。驱动程序尚未从服务器收到任何数据包。)

在运行应用程序时,我发现以下错误

HTTP状态500-请求处理失败;嵌套异常为org.springframework.transaction.CannotCreateTransactionException:无法打开事务的Hibernate会话;嵌套异常为org.hibernate.exception.genericjdbception:无法打开连接

applicationContext.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
            http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

    <context:annotation-config />
    <context:component-scan base-package="com" />
    <mvc:annotation-driven />

    <mvc:resources mapping="/resources/**" location="/resources/" />

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://reviewerdev.cm2ijsj83eo4.ap-south-1.rds.amazonaws.com/ORCL:1521" />
        <property name="username" value="username" />
        <property name="password" value="password" />

    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan" value="com.reviewer.entity" />
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.enable_lazy_load_no_tran">true</prop>
            </props>
        </property>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager"/>
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"></property>    
    </bean>
</beans>

org.hibernate.dialen.oraclealent
真的
真的
可以从SQLDeveloper工具访问数据库


有人知道这个问题的原因吗?

您想使用MySQL数据库,但配置了“org.hibernate.dialogue.oracleDialogue”。这是故意的吗?@KevinPeters我错过了那部分。我将其更新为“org.hibernate.dialogue.mysqldialogue”,但问题仍然存在。你能评论一下可能存在的问题吗?仅仅凭猜测很难确定这个问题。stacktrace中还有其他信息吗?例如,类似java.sql.SQLException的东西,带有语音错误消息?您是否仔细检查了数据库主机、端口和配置的凭据?凭据不是用户名和密码,是吗?