Cloud SQL for Postgres: Could not initialize class com.google.cloud.sql.postgres.SocketFactory
See original GitHub issueSystem information:
- Operating system (distribution) and version: MacOs Monterey v12.2
- DBeaver version: CE 21.3.4
- Additional extensions: N/A
Connection specification:
- Database name and version: PG 12
- Driver name: Cloud SQL for Postgres
- Do you use tunnels or proxies (SSH, SOCKS, etc)? N/A
Describe the problem you’re observing:
Something unusual has occurred to cause the driver to fail. Please report this exception.
com/google/cloud/sql/core/CoreSocketFactory
com/google/cloud/sql/core/CoreSocketFactory
com.google.cloud.sql.core.CoreSocketFactory
com.google.cloud.sql.core.CoreSocketFactory
Steps to reproduce, if exist:
- Download and install DBeaver
- Select “Connect to a database” and choose “Google Cloud SQL - PostgreSQL”
- Enter the INSTANCE_CONNECTION_NAME in the host/instances box (looks like it really doesn’t matter if you put one in)
- Click “Finish”
- Try using the datasource
Include any warning/errors/backtraces from the logs
java.lang.NoClassDefFoundError: Could not initialize class com.google.cloud.sql.postgres.SocketFactory
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at org.postgresql.util.ObjectFactory.instantiate(ObjectFactory.java:46)
at org.postgresql.core.SocketFactoryFactory.getSocketFactory(SocketFactoryFactory.java:39)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:182)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223)
at org.postgresql.Driver.makeConnection(Driver.java:465)
at org.postgresql.Driver.access$100(Driver.java:62)
at org.postgresql.Driver$ConnectThread.run(Driver.java:375)
at java.base/java.lang.Thread.run(Unknown Source)
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Connect using Cloud SQL connectors
The Cloud SQL connectors are libraries that provide encryption and IAM-based authorization when connecting to a Cloud SQL instance. They can't provide a ......
Read more >java.lang.NoClassDefFoundError: com/google/cloud/sql/core ...
You're trying to pass socketFactory=com.google.cloud.sql.postgres.SocketFactory parameter to JDBC connection string, while class ...
Read more >Cannot connect to Cloud SQL with Java SocketFactory Library
Hi, I do not know what is happening exactly, but I have a Dataflow streaming job that uses Postgres Cloud SQL with JdbcIO...
Read more >PostgreSQL connection fails due to java.net ... - GitHub
Hi all. I am using postgres-socket-factory for connecting to Cloud SQL from a local java Spark application. I have constructed a jdbc url ......
Read more >How to connect to Google CloudSQL Postgres with DBeaver
In this way they can play with the data themselves freely with a SQL client. Prerequisite. I am assuming that you have: A...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround we’ve explicitly added the missing dependency.
The fix will be available in DBeaver 21.3.5.
I’ve been able to let it work
https://github.com/dbeaver/dbeaver/issues/15526#issuecomment-1042905088