I'm trying to use the codebase to test connect a Google Cloud SQL instance with a GAE Application. I was able to run it successfully in local, but it seems that it gets deployed successfully also in AppEngine, but when I try to access myproject.appspot.com, I get a 404.
Following are the steps I followed (skipping the successful local related steps).
myproject
myproject-db
root
user with a password."jdbc:google:mysql://myproject:us-central1:myproject-db/demo?user=root&password=PASSWORD;"
appengine-web.xml looks like below
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>myproject</application>
<version>1</version>
<threadsafe>true</threadsafe>
<use-google-connector-j>true</use-google-connector-j>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
<property name="cloudsql.url" value="jdbc:google:mysql://myproject:us-central1:myproject-db/demo?user=root&password=PASSWORD;"/>
<property name="cloudsql.url.dev" value="jdbc:mysql://localhost/demo?user=root&useSSL=false"/>
</system-properties>
</appengine-web-app>
The following code snippet is embedded in HibernateJPAServlet
if (System.getProperty("com.google.appengine.runtime.version")
.startsWith("Google App Engine/")) {
Class.forName("com.mysql.jdbc.GoogleDriver");
properties.put("javax.persistence.jdbc.driver",
"com.mysql.jdbc.GoogleDriver");
properties.put("javax.persistence.jdbc.url",
System.getProperty("cloudsql.url"));
}
I've uploaded the code from my local to default myproject repository
I launched the Google Cloud Platform Console from the "Development" view.
mvn clean package
and mvn appengine:update
. I cannot perform a appengine:update
from my local due to firewall/proxy restrictions.http://myproject.appspot.com/
should host the application I uploaded Step 8. But when I access it says "404" - "The requested URL / was not found on this server."
Just in case the problem is we can't deploy it from Cloud Console, then what other alternative do I have? I absolutely can't change network/proxy rules.
I tried running and deploying the application with mvn gcloud:run
and mvn gcloud:deploy
from outside proxy/firewall restrictions. At the end it clearly stated "Deployed URL: [https://myproject.appspot.com]"
. But the same issue remains when I access the same Url through browser.
I am able to see the error trace from App Engine dashboard. It is saying
" org.hibernate.exception.JDBCConnectionException: Could not open connection
Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost."
My connection string is "jdbc:google:mysql://myproject:us-central1:myproject-db/demo?user=root&password=PASSWD123&"
It was my Bad (also partially Documentation gap and I've given feedback too). Everytime we deploy the app through appengine
or gcloud
, the newly deployed version should be visible through the "App Engine > Versions"
Tab. We should "Split Traffic"
and give "100%"
(for testing) to the Newly deployed version and then launch "https://myproject.appspot.com" to see the results we want to see.