在本地开发服务器上运行的 Java Google App Engine 和 Google Cloud SQL [英] Java Google App Engine and Google Cloud SQL running on local dev server
问题描述
我整个星期都在研究这个问题的解决方案,虽然有类似问题的解决方案,但没有一个可以直接解决和纠正这个问题.
I've been researching a solution to this all week and while there have been solutions to similar problems there are none that address and rectify this problem directly.
我使用 Google App Engine 和 Google Cloud SQL 创建了一个网络应用程序项目.使用 eclipse Google 插件和本地 MySQL 服务器运行 GAE 应用程序,该应用程序运行良好.
I have created a web application project using Google App Engine and Google Cloud SQL. Running the GAE application using the eclipse Google plugin and a local MySQL server the application works great.
使用以下命令从命令行运行应用程序时:-
When running the application from the command line using:-
sudo /opt/appengine-java-sdk-1.6.1/bin/dev_appserver.sh --jvm_flag=-Drdbms.server=local --jvm_flag=-Drdbms.driver=com.mysql.jdbc.Driver --jvm_flag=-Drdbms.url=jdbc:mysql://localhost:3306/twincam?user=root --port=7070 /home/ben/workspace/Twincam/war
我得到以下信息:-
java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver.registerDriver(LocalRdbmsServiceLocalDriver.java:95)
我的用户库引用了位于/Twincam/war/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar 中的 mysql-connector.jar 类路径,如下所示.类路径文件和目录结构:-
I have the classpath referencing the mysql-connector.jar located in /Twincam/war/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar referenced by my user library as in the following .classpath file and directory structure :-
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gson-2.1-javadoc.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gson-2.1-sources.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gson-2.1.jar"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
<小时>
更新:我检查了文件权限,所有权限都设置为默认的 664,所以我相信这不是问题.
Update: I checked file permissions and all are set at the default 664 so I'm confident that this is not the problem.
推荐答案
我遇到了同样的问题.
我通过在 appengine-java-sdk-x.x.x/lib/impl 中删除 mysql .jar 解决了这个问题.
I solved it by dropping the mysql .jar in appengine-java-sdk-x.x.x/lib/impl.
这篇关于在本地开发服务器上运行的 Java Google App Engine 和 Google Cloud SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!