AWS Beanstalk 到 RDS 与 DataNucleus 的问题
我正在尝试运行部署到 Amazon Beanstalk 的 JSP 文件,该文件使用 DataNucleus 连接到 RDS,并且收到以下错误:
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)
现在我在类路径中拥有 MySQL 连接器文件(位于 WebContent/WEB-INF /lib/mysql-connector-java-5.1.15-bin.jar
,所以这应该可以工作,
我也确认如果我从那里删除库,我会得到“com.mysql.jdbc.Driver”。在 CLASSPATH 上找不到”错误。
我的 datanucleus.properties 文件如下所示:
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
所有这些都在连接到 RDS 的本地 Tomcat 上运行。只有在 Beanstalk 上运行时才会失败。
任何想法可能会发生什么导致这个问题
?
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我[几乎]使用以下过程解决了这个问题:
http://www.cubehouse.org/blog/2011/03/04/using-rds-aws-mysql-on-an-elastic-beanstalk-java-tomcat-server- with-ec2-security-permissions/
此外,您的 EC2 安全组需要端口 3306 的规则集。
遗憾的是,这段代码只能读,不能写。
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.
因此,我们降级到 DataNucleus 2.0,没有进行任何其他更改,问题就消失了。悲伤,但它有效。我不推荐使用 MySQL 的较新版本的 DataNucleus。
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.