{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/615","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/cloud-tools-for-eclipse","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/615/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/615/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/615/events","html_url":"https://github.com/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/615","id":173388548,"number":615,"title":"Unable to connecto to Google Cloud SQL from development environment","user":{"login":"NicolaSpreafico","id":12278553,"avatar_url":"https://avatars.githubusercontent.com/u/12278553?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolaSpreafico","html_url":"https://github.com/NicolaSpreafico","followers_url":"https://api.github.com/users/NicolaSpreafico/followers","following_url":"https://api.github.com/users/NicolaSpreafico/following{/other_user}","gists_url":"https://api.github.com/users/NicolaSpreafico/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolaSpreafico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolaSpreafico/subscriptions","organizations_url":"https://api.github.com/users/NicolaSpreafico/orgs","repos_url":"https://api.github.com/users/NicolaSpreafico/repos","events_url":"https://api.github.com/users/NicolaSpreafico/events{/privacy}","received_events_url":"https://api.github.com/users/NicolaSpreafico/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-26T07:36:25Z","updated_at":"2016-08-26T19:30:37Z","closed_at":null,"body":"Hello,\r\nI'm getting a python exception with a simple code which use JDBC driver to connect to Google Cloud SQL instances\r\n\r\nAt first I created a new `Hello World Example` Maven project.\r\nI addes this dependency\r\n```\r\n<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->\r\n<dependency>\r\n\t<groupId>mysql</groupId>\r\n\t<artifactId>mysql-connector-java</artifactId>\r\n\t<version>5.1.39</version>\r\n</dependency>\r\n```\r\n\r\nAnd I created this sample code inside the `HelloAppEngine` servlet\r\n```\r\nprivate void testSql() throws ClassNotFoundException, SQLException {\r\n\tString driver = \"com.mysql.jdbc.Driver\";\r\n\tClass.forName(driver);\r\n\r\n\tString host = \"xxxx\";\r\n\tString schema = \"xxxx\";\r\n\tString user = \"xxxx\";\r\n\tString password = \"xxxxx\";\r\n\tString table = \"xxxxx\";\r\n\r\n\tConnection con = DriverManager.getConnection(\"jdbc:mysql://\" + host + \":3306/\" + schema, user, password);\r\n\tStatement cmd = con.createStatement();\r\n\r\n\tString qry = \"SELECT * FROM \" + table + \" LIMIT 10\";\r\n\tResultSet res = cmd.executeQuery(qry);\r\n\r\n\twhile (res.next()) {\r\n\t\tSystem.out.println(res.getInt(\"id\"));\r\n\t}\r\n\r\n\tres.close();\r\n\tcmd.close();\r\n\tcon.close();\r\n}\r\n```\r\n\r\nThere is a massive stacktrace when the DriverManager.getConnection method is hitted.\r\n\r\nHere is the main stacktrace\r\n```\r\ncom.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:526)\r\n\tat com.mysql.jdbc.Util.handleNewInstance(Util.java:404)\r\n\tat com.mysql.jdbc.Util.getInstance(Util.java:387)\r\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:917)\r\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896)\r\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885)\r\n\tat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)\r\n\tat com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2330)\r\n\tat com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)\r\n\tat com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)\r\n\tat com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:526)\r\n\tat com.mysql.jdbc.Util.handleNewInstance(Util.java:404)\r\n\tat com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)\r\n\tat com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)\r\n\tat java.sql.DriverManager.getConnection(DriverManager.java:571)\r\n\tat java.sql.DriverManager.getConnection(DriverManager.java:215)\r\n\tat it.noovle.testsql.HelloAppEngine.testSql(HelloAppEngine.java:54)\r\n```\r\n\r\nAnd here is the original cause\r\n```\r\ncom.google.appengine.tools.remoteapi.RemoteApiException: response was a python exception:\r\ncgoogle.appengine.runtime.apiproxy_errors\r\nApplicationError\r\np0\r\n(I1\r\ntp1\r\nRp2\r\n(dp3\r\nS'application_error'\r\np4\r\nI1\r\nsS'error_detail'\r\np5\r\nS'system_error:10049 error_detail:\"Indirizzo richiesto non valido nel proprio contesto\"'\r\n(the english counterpart should be \"request address not valid in its context\")\r\np6\r\nsb.\r\n\tat com.google.appengine.tools.development.devappserver2.RemoteRpc.call(RemoteRpc.java:65)\r\n```\r\n\r\nI first got this error from my main project (which I'm still try to make it run with this new plugin, I'm getting several errors which I'm opening different issues on this tracker, one by one I'm moving on). But after I made this simple test project without anything else I can relate that the error is genuine.\r\n\r\nDue to a python error I can guess the problem is with GCloud installation itself (and not this plugin, or even my local PC configuration) but at first I would like to have a confirmation by other users."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/comments/242829795","html_url":"https://github.com/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/615#issuecomment-242829795","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/cloud-tools-for-eclipse/issues/615","id":242829795,"user":{"login":"NicolaSpreafico","id":12278553,"avatar_url":"https://avatars.githubusercontent.com/u/12278553?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolaSpreafico","html_url":"https://github.com/NicolaSpreafico","followers_url":"https://api.github.com/users/NicolaSpreafico/followers","following_url":"https://api.github.com/users/NicolaSpreafico/following{/other_user}","gists_url":"https://api.github.com/users/NicolaSpreafico/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolaSpreafico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolaSpreafico/subscriptions","organizations_url":"https://api.github.com/users/NicolaSpreafico/orgs","repos_url":"https://api.github.com/users/NicolaSpreafico/repos","events_url":"https://api.github.com/users/NicolaSpreafico/events{/privacy}","received_events_url":"https://api.github.com/users/NicolaSpreafico/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T19:30:37Z","updated_at":"2016-08-26T19:30:37Z","body":"Do you mean the `gcloud:run` command from the `gcloud-maven-plugin`?\r\nYes, I tried but I had blocking error starting the server in this way:\r\n```\r\n[INFO] <<< gcloud-maven-plugin:2.0.9.121.v20160815:run (default-cli) < package @ testsql <<<\r\n[INFO] \r\n[INFO] --- gcloud-maven-plugin:2.0.9.121.v20160815:run (default-cli) @ testsql ---\r\n[INFO] \r\n[INFO] Running gcloud app run...\r\n[INFO] Creating staging directory in: C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\appengine-staging\r\n[INFO] Running appcfg --disable_update_check -A notused stage C:\\Users\\Francesco\\workspace_neon\\testsql\\target/testsql-1 C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\appengine-staging\r\nReading application configuration data...\r\n\r\n\r\nBeginning interaction for module default...\r\n0% Scanning for jsp files.\r\nSuccess.\r\nTemporary staging for module default directory left in C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\appengine-staging\r\n[INFO] Running python.exe -S C:\\Users\\Francesco\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk/platform/google_appengine/dev_appserver.py --skip_sdk_update_check=true -A app C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\testsql-1/app.yaml\r\n[ERROR] \r\norg.apache.maven.plugin.MojoExecutionException: Could not start the dev app server\r\n\tat com.google.appengine.gcloudapp.AbstractGcloudMojo.startCommand(AbstractGcloudMojo.java:472)\r\n\tat com.google.appengine.gcloudapp.GCloudAppRun.execute(GCloudAppRun.java:280)\r\n\tat org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)\r\n\tat org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)\r\n\tat org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)\r\n\tat org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)\r\n\tat org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)\r\n\tat org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)\r\n\tat org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)\r\n\tat org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)\r\n\tat org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)\r\n\tat org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)\r\n\tat org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)\r\n\tat org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)\r\n\tat org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)\r\n\tat org.apache.maven.cli.MavenCli.main(MavenCli.java:199)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)\r\n\tat org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)\r\nCaused by: java.io.IOException: Cannot run program \"python.exe\" (in directory \"C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\testsql-1\"): CreateProcess error=2, Impossibile trovare il file specificato\r\n\tat java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)\r\n\tat com.google.appengine.gcloudapp.AbstractGcloudMojo.startCommand(AbstractGcloudMojo.java:392)\r\n\t... 23 more\r\nCaused by: java.io.IOException: CreateProcess error=2, Impossibile trovare il file specificato\r\n\tat java.lang.ProcessImpl.create(Native Method)\r\n\tat java.lang.ProcessImpl.<init>(ProcessImpl.java:386)\r\n\tat java.lang.ProcessImpl.start(ProcessImpl.java:137)\r\n\tat java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)\r\n\t... 24 more\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] BUILD FAILURE\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Total time: 4.769 s\r\n[INFO] Finished at: 2016-08-26T21:20:54+02:00\r\n[INFO] Final Memory: 21M/268M\r\n[INFO] ------------------------------------------------------------------------\r\n[ERROR] Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.121.v20160815:run (default-cli) on project testsql: Execution error: org.apache.maven.plugin.MojoExecutionException: Could not start the dev app server -> [Help 1]\r\n[ERROR] \r\n```\r\n\r\nI thought was because I did not have the python folder inside my `PATH` variable, so I added the `C:\\Program Files (x86)\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\bundledpython` folder to the `PATH`.\r\nThe `python.exe` line is correct, if I use that directly from the cmd-prompt I get the python instance\r\n```\r\nC:\\Users\\Francesco>python.exe\r\nPython 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>>\r\n```\r\n\r\nSo I tried the maven command again and the server started\r\n```\r\n[INFO] <<< gcloud-maven-plugin:2.0.9.121.v20160815:run (default-cli) < package @ testsql <<<\r\n[INFO] \r\n[INFO] --- gcloud-maven-plugin:2.0.9.121.v20160815:run (default-cli) @ testsql ---\r\n[INFO] \r\n[INFO] Running gcloud app run...\r\n[INFO] Creating staging directory in: C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\appengine-staging\r\n[INFO] Running appcfg --disable_update_check -A notused stage C:\\Users\\Francesco\\workspace_neon\\testsql\\target/testsql-1 C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\appengine-staging\r\nReading application configuration data...\r\n\r\n\r\nBeginning interaction for module default...\r\n0% Scanning for jsp files.\r\nSuccess.\r\nTemporary staging for module default directory left in C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\appengine-staging\r\n[INFO] Running python.exe -S C:\\Users\\Francesco\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk/platform/google_appengine/dev_appserver.py --skip_sdk_update_check=true -A app C:\\Users\\Francesco\\workspace_neon\\testsql\\target\\testsql-1/app.yaml\r\n[INFO] INFO     2016-08-26 21:26:49,526 devappserver2.py:769] Skipping SDK update check.\r\n[INFO] WARNING  2016-08-26 21:26:50,575 simple_search_stub.py:1146] Could not read search indexes from c:\\users\\france~1\\appdata\\local\\temp\\appengine.app\\search_indexes\r\n[INFO] INFO     2016-08-26 21:26:50,582 api_server.py:205] Starting API server at: http://localhost:55261\r\n[INFO] INFO     2016-08-26 21:26:50,588 dispatcher.py:197] Starting module \"default\" running at: http://localhost:8080\r\n[INFO] INFO     2016-08-26 21:26:50,592 admin_server.py:116] Starting admin server at: http://localhost:8000\r\n[INFO] ago 26, 2016 9:26:52 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties\r\n..... more server start log .....\r\n```\r\n\r\nI hitted the test servlet and indeed the error is still there\r\n```\r\nCaused by: com.google.appengine.tools.remoteapi.RemoteApiException: response was a python exception:\r\ncgoogle.appengine.runtime.apiproxy_errors\r\nApplicationError\r\np0\r\n(I1\r\ntp1\r\nRp2\r\n(dp3\r\nS'application_error'\r\np4\r\nI1\r\nsS'error_detail'\r\np5\r\nS'system_error:10049 error_detail:\"Indirizzo richiesto non valido nel proprio contesto\"'\r\np6\r\nsb.\r\n\tat com.google.appengine.tools.development.devappserver2.RemoteRpc.call(RemoteRpc.java:65)\r\n\tat com.google.appengine.tools.development.devappserver2.RemoteApiDelegate.makeSyncCall(RemoteApiDelegate.java:45)\r\n\tat com.google.appengine.tools.development.devappserver2.DevAppServer2Delegate.makeSyncCall(DevAppServer2Delegate.java:58)\r\n\tat com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:118)\r\n\tat com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:67)\r\n\tat com.google.appengine.api.socket.SocketApiHelper.apiProxyMakeSyncCall(SocketApiHelper.java:81)\r\n\tat com.google.appengine.api.socket.SocketApiHelper.makeSyncCall(SocketApiHelper.java:52)\r\n\tat com.google.appengine.api.socket.AppEngineSocketImpl.connectSocket(AppEngineSocketImpl.java:397)\r\n\tat com.google.appengine.api.socket.AppEngineSocketImpl.connectToAddress(AppEngineSocketImpl.java:348)\r\n\tat com.google.appengine.api.socket.AppEngineSocketImpl.connect(AppEngineSocketImpl.java:332)\r\n\tat java.net.Socket.connect(Socket.java:579)\r\n\tat com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)\r\n\tat com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)\r\n\tat com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251)\r\n\tat com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)\r\n```\r\n\r\nThis is a confirmation that the problem is gcloud related, and not strictly to Eclipse.\r\nThanks you on suggesting the alternative way on start the server."}}
{"actor":{"display_login":"NicolaSpreafico"}}