java - No suitable driver found on connect to Amazon MySQL Database -


i'm trying connect amazon rds mysql db hibernate using following properties:

    <prop key="hibernate.connection.driver_class">com.mysql.jdbc.driver</prop>     <prop key="hibernate.dialect">org.hibernate.spatial.dialect.mysql.mysqlspatialdialect</prop>     <prop key="hibernate.show_sql">false</prop>     <prop key="hibernate.generateddl">true</prop>      <!-- aws rds mysql instance -->     <prop key="hibernate.connection.url">jdbc:mysql:mysqlinstance.cdlzan3wpebb.eu-central-1.rds.amazonaws.com/database:3306/database?usessl=false</prop>     <prop key="hibernate.connection.username">{user}</prop>     <prop key="hibernate.connection.password">{password}</prop> 

unfortunately leading no suitable driver found sqlexception. see following stack trace more information:

org.springframework.beans.factory.beancreationexception: error creating bean name 'databaseinitializer' defined in class path resource [applicationcontext.xml]: invocation of init method failed; nested exception org.springframework.transaction.cannotcreatetransactionexception: not open jpa entitymanager transaction; nested exception javax.persistence.persistenceexception: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1512)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:521)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:458)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:296)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:223)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:293)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:628)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:932)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:479)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:410)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:306)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:112)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:5077)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5591)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1574)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1564)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:745) caused by: org.springframework.transaction.cannotcreatetransactionexception: not open jpa entitymanager transaction; nested exception javax.persistence.persistenceexception: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.springframework.orm.jpa.jpatransactionmanager.dobegin(jpatransactionmanager.java:428)     @ org.springframework.transaction.support.abstractplatformtransactionmanager.gettransaction(abstractplatformtransactionmanager.java:372)     @ org.springframework.transaction.interceptor.transactionaspectsupport.createtransactionifnecessary(transactionaspectsupport.java:417)     @ org.springframework.transaction.interceptor.transactionaspectsupport.invokewithintransaction(transactionaspectsupport.java:255)     @ org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:94)     @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:172)     @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:204)     @ com.sun.proxy.$proxy39.findbyemail(unknown source)     @ com.company.dao.databaseinitializer.initdatabase(databaseinitializer.java:57)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokecustominitmethod(abstractautowirecapablebeanfactory.java:1638)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1579)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1509)     ... 21 more caused by: javax.persistence.persistenceexception: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1763)     @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1677)     @ org.hibernate.jpa.spi.abstractentitymanagerimpl.throwpersistenceexception(abstractentitymanagerimpl.java:1771)     @ org.hibernate.jpa.internal.transactionimpl.begin(transactionimpl.java:64)     @ org.springframework.orm.jpa.defaultjpadialect.begintransaction(defaultjpadialect.java:71)     @ org.springframework.orm.jpa.vendor.hibernatejpadialect.begintransaction(hibernatejpadialect.java:61)     @ org.springframework.orm.jpa.jpatransactionmanager.dobegin(jpatransactionmanager.java:378)     ... 36 more caused by: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.hibernate.exception.internal.sqlstateconversiondelegate.convert(sqlstateconversiondelegate.java:132)     @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:49)     @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:126)     @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:112)     @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:235)     @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.getconnection(logicalconnectionimpl.java:171)     @ org.hibernate.engine.transaction.internal.jdbc.jdbctransaction.dobegin(jdbctransaction.java:67)     @ org.hibernate.engine.transaction.spi.abstracttransactionimpl.begin(abstracttransactionimpl.java:162)     @ org.hibernate.internal.sessionimpl.begintransaction(sessionimpl.java:1435)     @ org.hibernate.jpa.internal.transactionimpl.begin(transactionimpl.java:61)     ... 39 more caused by: java.sql.sqlexception: no suitable driver found jdbc:mysql:mysqlinstance.cdlzan3wpebb.eu-central-1.rds.amazonaws.com/database?usessl=false     @ java.sql.drivermanager.getconnection(drivermanager.java:596)     @ java.sql.drivermanager.getconnection(drivermanager.java:187)     @ org.springframework.jdbc.datasource.drivermanagerdatasource.getconnectionfromdrivermanager(drivermanagerdatasource.java:173)     @ org.springframework.jdbc.datasource.drivermanagerdatasource.getconnectionfromdriver(drivermanagerdatasource.java:164)     @ org.springframework.jdbc.datasource.abstractdriverbaseddatasource.getconnectionfromdriver(abstractdriverbaseddatasource.java:153)     @ org.springframework.jdbc.datasource.abstractdriverbaseddatasource.getconnection(abstractdriverbaseddatasource.java:119)     @ org.hibernate.engine.jdbc.connections.internal.datasourceconnectionproviderimpl.getconnection(datasourceconnectionproviderimpl.java:139)     @ org.hibernate.internal.abstractsessionimpl$noncontextualjdbcconnectionaccess.obtainconnection(abstractsessionimpl.java:380)     @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:228)     ... 44 more may 28, 2016 1:54:32 pm org.apache.catalina.core.standardcontext listenerstart severe: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'databaseinitializer' defined in class path resource [applicationcontext.xml]: invocation of init method failed; nested exception org.springframework.transaction.cannotcreatetransactionexception: not open jpa entitymanager transaction; nested exception javax.persistence.persistenceexception: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1512)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:521)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:458)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:296)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:223)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:293)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:628)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:932)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:479)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:410)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:306)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:112)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:5077)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5591)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1574)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1564)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:745) caused by: org.springframework.transaction.cannotcreatetransactionexception: not open jpa entitymanager transaction; nested exception javax.persistence.persistenceexception: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.springframework.orm.jpa.jpatransactionmanager.dobegin(jpatransactionmanager.java:428)     @ org.springframework.transaction.support.abstractplatformtransactionmanager.gettransaction(abstractplatformtransactionmanager.java:372)     @ org.springframework.transaction.interceptor.transactionaspectsupport.createtransactionifnecessary(transactionaspectsupport.java:417)     @ org.springframework.transaction.interceptor.transactionaspectsupport.invokewithintransaction(transactionaspectsupport.java:255)     @ org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:94)     @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:172)     @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:204)     @ com.sun.proxy.$proxy39.findbyemail(unknown source)     @ com.company.dao.databaseinitializer.initdatabase(databaseinitializer.java:57)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokecustominitmethod(abstractautowirecapablebeanfactory.java:1638)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1579)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1509)     ... 21 more caused by: javax.persistence.persistenceexception: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1763)     @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1677)     @ org.hibernate.jpa.spi.abstractentitymanagerimpl.throwpersistenceexception(abstractentitymanagerimpl.java:1771)     @ org.hibernate.jpa.internal.transactionimpl.begin(transactionimpl.java:64)     @ org.springframework.orm.jpa.defaultjpadialect.begintransaction(defaultjpadialect.java:71)     @ org.springframework.orm.jpa.vendor.hibernatejpadialect.begintransaction(hibernatejpadialect.java:61)     @ org.springframework.orm.jpa.jpatransactionmanager.dobegin(jpatransactionmanager.java:378)     ... 36 more caused by: org.hibernate.exception.jdbcconnectionexception: not open connection     @ org.hibernate.exception.internal.sqlstateconversiondelegate.convert(sqlstateconversiondelegate.java:132)     @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:49)     @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:126)     @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:112)     @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:235)     @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.getconnection(logicalconnectionimpl.java:171)     @ org.hibernate.engine.transaction.internal.jdbc.jdbctransaction.dobegin(jdbctransaction.java:67)     @ org.hibernate.engine.transaction.spi.abstracttransactionimpl.begin(abstracttransactionimpl.java:162)     @ org.hibernate.internal.sessionimpl.begintransaction(sessionimpl.java:1435)     @ org.hibernate.jpa.internal.transactionimpl.begin(transactionimpl.java:61)     ... 39 more caused by: java.sql.sqlexception: no suitable driver found jdbc:mysql:mysqlinstance.cdlzan3wpebb.eu-central-1.rds.amazonaws.com/database?usessl=false     @ java.sql.drivermanager.getconnection(drivermanager.java:596)     @ java.sql.drivermanager.getconnection(drivermanager.java:187)     @ org.springframework.jdbc.datasource.drivermanagerdatasource.getconnectionfromdrivermanager(drivermanagerdatasource.java:173)     @ org.springframework.jdbc.datasource.drivermanagerdatasource.getconnectionfromdriver(drivermanagerdatasource.java:164)     @ org.springframework.jdbc.datasource.abstractdriverbaseddatasource.getconnectionfromdriver(abstractdriverbaseddatasource.java:153)     @ org.springframework.jdbc.datasource.abstractdriverbaseddatasource.getconnection(abstractdriverbaseddatasource.java:119)     @ org.hibernate.engine.jdbc.connections.internal.datasourceconnectionproviderimpl.getconnection(datasourceconnectionproviderimpl.java:139)     @ org.hibernate.internal.abstractsessionimpl$noncontextualjdbcconnectionaccess.obtainconnection(abstractsessionimpl.java:380)     @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:228)     ... 44 more 

the amazon rds mysql instance set publicly accessible. additionally added inbound rule mysql 0.0.0.0/0 vpc containing database instance.

i have no idea why not working. on localhost went fine. mysql version differs in minor version (5.7.9 instead of 5.7.10)

i hope can enlighten me :) in advance.

in config should have jdbc:<db>://{dbinstance}.endpoint:{port}/{database} you're missing // part after protocol

    <prop key="hibernate.connection.url">jdbc:mysql://mysqlinstance.cdlzan3wpebb.eu-central-1.rds.amazonaws.com/database:3306/database?usessl=false</prop> 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -