0
votes

I am trying to run a JSP file deployed to Amazon's Beanstalk, which uses DataNucleus to connect to RDS, and am getting the following error:

javax.jdo.JDOFatalDataStoreException: No suitable driver found for jdbc:mysql://mydbblahblah.rds.amazonaws.com:3306/mydb?autoReconnect=true

root cause

java.sql.SQLException: No suitable driver found for jdbc:mysql://bmydbblahblah.rds.amazonaws.com:3306/mydb?autoReconnect=true
    java.sql.DriverManager.getConnection(DriverManager.java:640)
    java.sql.DriverManager.getConnection(DriverManager.java:200)

Now I have the MySQL connector files in the classpath (it is at WebContent/WEB-INF/lib/mysql-connector-java-5.1.15-bin.jar, so this should work.

I have also confirmed that if I remove the library from there, I get the "com.mysql.jdbc.Driver not found on CLASSPATH" error.

Here is what my datanucleus.properties file looks like this:

javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory

javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver
javax.jdo.option.ConnectionURL=jdbc:mysql://bmydbblahblah.rds.amazonaws.com:3306/mydb
#javax.jdo.option.ConnectionURL=jdbc:mysql://localhost:3306/mydb?autoReconnect=true
javax.jdo.option.ConnectionUserName=user
javax.jdo.option.ConnectionPassword=pwnothere

All of this works on my local Tomcat connecting to RDS. It only fails when running on Beanstalk.

Any ideas what might be causing this issue?

Thanks

2
NO idea about your issue, other than trying the jdbc driver in different locations, but just wondered if you'd have time to document something about using DataNucleus on Beanstalk and provide it back to the DataNucleus project? ThxDataNucleus
Until it is working, there is nothing to document. DataNucleus is a fantastic idea, but getting it to work, and work consistently, is never easy.Peter Sankauskas
Needless to say it works for us on all platforms we've provided it for, and have no reported issue preventing its use on those. Onus is always on people to define their problem, and optionally, contribute to it.DataNucleus
That is JDBC that is looking for the driver and not finding it, not DataNucleus. So you ought to have looked at registration of the driver and where you put it in the CLASSPATH and check that it is being registeredNeil Stockton

2 Answers

0
votes

I [almost] resolved this issue using the following procedure: http://www.cubehouse.org/blog/2011/03/04/using-rds-aws-mysql-on-an-elastic-beanstalk-java-tomcat-server-with-ec2-security-permissions/

With the addition that your EC2 Security Group needs a rule set for port 3306. Sadly, this code can read but not write.

-1
votes

So we downgraded to DataNucleus 2.0 without any other changes, and the issue disappeared. Sad, but it worked. I cannot recommend newer versions of DataNucleus with MySQL.