在本地开发服务器上运行Java Java App Engine和Google Cloud SQL [英] Java Google App Engine and Google Cloud SQL running on local dev server

查看:111
本文介绍了在本地开发服务器上运行Java Java App Engine和Google Cloud SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究这个问题的解决方案,虽然有类似问题的解决方案,但没有任何解决方案可以直接解决这个问题。

I已经使用Google App Engine和Google Cloud SQL创建了一个Web应用程序项目。
使用eclipse Google插件和本地MySQL服务器运行GAE应用程序时,应用程序运行良好。



使用以下命令从命令行运行应用程序时: -

  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 

我得到以下信息: - $ / b>

  java.lang.IllegalStateException:java.lang.ClassNotFoundException:com.mysql.jdbc.Driver 
,位于com.google.appengine.api.rdbms。 dev.LocalRdbmsServiceLocalDriver.registerDriver(LocalRdbmsServiceLocalDriver.java:95)

我有引用mysql-connector的类路径位于/Twincam/war/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar中的.jar位于我的用户库中,如以下.classpath文件所示d目录结构:

 <?xml version =1.0encoding =UTF-8?> 
< classpath>
< classpathentry kind =srcpath =src/>
< classpathentry kind =conpath =com.google.appengine.eclipse.core.GAE_CONTAINER/>
< classpathentry kind =conpath =org.eclipse.jdt.launching.JRE_CONTAINER/>
< classpathentry kind =libpath =war / WEB-INF / lib / mysql-connector-java-5.1.18-bin.jar/>
< classpathentry kind =libpath =war / WEB-INF / lib / gson-2.1-javadoc.jar/>
< classpathentry kind =libpath =war / WEB-INF / lib / gson-2.1-sources.jar/>
< classpathentry kind =libpath =war / WEB-INF / lib / gson-2.1.jar/>
< classpathentry kind =outputpath =war / WEB-INF / classes/>
< / classpath>







更新:我检查了文件权限,并且所有设置都是默认的664我相信这不是问题。

解决方案

我有同样的问题。



我通过在appengine-java-sdk-xxx / lib / impl中删除mysql .jar来解决它。


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.

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

I get the following:-

java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver.registerDriver(LocalRdbmsServiceLocalDriver.java:95)

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>


Update: I checked file permissions and all are set at the default 664 so I'm confident that this is not the problem.

解决方案

I had the same problem.

I solved it by dropping the mysql .jar in appengine-java-sdk-x.x.x/lib/impl.

这篇关于在本地开发服务器上运行Java Java App Engine和Google Cloud SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆