question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cloud SQL for Postgres: Could not initialize class com.google.cloud.sql.postgres.SocketFactory

See original GitHub issue

System 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:

  1. Download and install DBeaver
  2. Select “Connect to a database” and choose “Google Cloud SQL - PostgreSQL”
  3. Enter the INSTANCE_CONNECTION_NAME in the host/instances box (looks like it really doesn’t matter if you put one in)
  4. Click “Finish”
  5. 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:closed
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ShadelessFoxcommented, Feb 18, 2022

As a workaround we’ve explicitly added the missing dependency.

The fix will be available in DBeaver 21.3.5.

1reaction
e-compagnocommented, Feb 17, 2022
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found