Comments (18)
I will investigate this issue.
from spring-cloud-gcp.
@amynguyen780 The <dependencyManagement>
only controls the version, it does not add the dependency.
My pom.xml file is:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>5.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
</dependency>
</dependencies>
Please try the following:
mvn clean install -U
mvn spring-boot:run
I was not able to reproduce your issue.
The latest changes are used by the spring-cloud-gcp-sql-postgres-sample and it works.
from spring-cloud-gcp.
One option is to add the following to com.spotify:bom
dependency, so the Cloud SQL deps version will be defined by spring-cloud-gcp-dependencies:5.1.0
.
<exclusions>
<exclusion>
<groupId>com.google.cloud.sql</groupId>
<artifactId>postgres-socket-factory</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.cloud.sql</groupId>
<artifactId>jdbc-socket-factory-core</artifactId>
</exclusion>
</exclusions>
Since this is not a bug, I'll close this ticket. If you encounter any new issues, feel free to report them by opening a new bug ticket. Thanks!
from spring-cloud-gcp.
@ttosta-google FYI
from spring-cloud-gcp.
Thanks @amynguyen780 for reporting this issue.
Try adding the BOM to your pom.xml like recommended here:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>5.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Please let us know if it fixes this issue.
from spring-cloud-gcp.
So I added what you suggested and removed all the other dependencies I specified in the issue description since I assumed that this pom would cover all of those but then it apparently didn't and I needed to add back spring-cloud-gcp-pubsub
and spring-cloud-gcp-starter-sql-postgresql
, and then I get the same error when I start the application about java.lang.NoClassDefFoundError: com/google/cloud/sql/ConnectorRegistry
.
from spring-cloud-gcp.
@ttosta-google any ideas?
from spring-cloud-gcp.
Got it. Ok so then I tried leaving all of the dependencies I had specified before but removed the pinned version at those individual dependencies and used the dependencyManagement pom import to specify the version, but I'm still getting the same error when trying to run the application. Did com.google.cloud.sql.ConnectorRegistry
get moved to a different library in the version bump? I even tried using the latest version (5.1.2), but yeah something about from 5.1.0 on, this import is not being resolved.
from spring-cloud-gcp.
Ah I see this particular file got changed here. And I ran mvn dependency:tree
and saw:
[INFO] +- com.google.cloud:spring-cloud-gcp-starter-sql-postgresql:jar:5.1.0:compile
[INFO] | +- com.google.cloud.sql:postgres-socket-factory:jar:1.11.1:compile
[INFO] | | \- com.google.cloud.sql:jdbc-socket-factory-core:jar:1.11.1:compile
So weirdly, I'm not pulling in the version specified in the pom.xml here but an older one...
from spring-cloud-gcp.
The version of com.google.cloud.sql:postgres-socket-factory
is defined in the <dependencyManagement>
section here. It is possible that another library imported by your project is setting the version to 1.11.1
. To confirm this, please run mvn dependency:tree
again and check if the library is being used in multiple places.
To force the version 1.16.0
you could add the following to your <dependencyManagement>
:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>5.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>postgres-socket-factory</artifactId>
<version>1.16.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>jdbc-socket-factory-core</artifactId>
<version>1.16.0</version>
</dependency>
</dependencies>
</dependencyManagement>
It is only recommended if your project has two libraries defining the version for com.google.cloud.sql:postgres-socket-factory
. If your projects only needs spring-cloud-gcp-starter-sql-postgresql
, them adding the POM com.google.cloud:spring-cloud-gcp-dependencies
should be enough.
from spring-cloud-gcp.
Looking at the maven dependency tree, I see that I'm only pulling the postgres-socket-factory
and jdbc-socket-factory-core
dependencies from spring-cloud-gcp-starter-sql-postgresql
which is at v5.1.0. I then specified these two dependencies explicitly with v1.16.0 pinned as you have above and it's now using those versions, but now I get another issue:
Caused by: java.lang.NoSuchMethodError: 'java.lang.String com.google.api.services.sqladmin.model.ConnectSettings.getDnsName()'
at com.google.cloud.sql.core.DefaultConnectionInfoRepository.fetchMetadata(DefaultConnectionInfoRepository.java:217)
at com.google.cloud.sql.core.DefaultConnectionInfoRepository.lambda$getConnectionInfo$0(DefaultConnectionInfoRepository.java:111)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
from spring-cloud-gcp.
Please run mvn help:effective-pom -Dverbose
and send me the output for postgres-socket-factory
and jdbc-socket-factory-core
dependencies.
My output is:
<dependency>
<groupId>com.google.cloud.sql</groupId> <!-- com.google.cloud:spring-cloud-gcp-dependencies:5.1.0, line 257 -->
<artifactId>postgres-socket-factory</artifactId> <!-- com.google.cloud:spring-cloud-gcp-dependencies:5.1.0, line 258 -->
<version>1.16.0</version> <!-- com.google.cloud:spring-cloud-gcp-dependencies:5.1.0, line 259 -->
</dependency>
Thanks!
from spring-cloud-gcp.
<dependency>
<groupId>com.google.cloud.sql</groupId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 310 -->
<artifactId>postgres-socket-factory</artifactId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 311 -->
<version>1.16.0</version> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 312 -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 315 -->
<artifactId>jdbc-socket-factory-core</artifactId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 316 -->
<version>1.16.0</version> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 317 -->
<scope>compile</scope>
</dependency>
from spring-cloud-gcp.
Please remove the Cloud SQL dependencies from your project's <dependencyManagement>
first. I would like to see which dependency is setting their version to 1.11.1
. Thanks!
from spring-cloud-gcp.
Ah ok so I removed the pinned 1.16.0 version on these two dependencies and this is what I get:
<dependency>
<groupId>com.google.cloud.sql</groupId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 310 -->
<artifactId>postgres-socket-factory</artifactId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 311 -->
<version>1.11.1</version> <!-- com.spotify:bom:2279, line 1117 -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 314 -->
<artifactId>jdbc-socket-factory-core</artifactId> <!-- com.spotify:ads-api-server:0.0.1-SNAPSHOT, line 315 -->
<version>1.11.1</version> <!-- com.spotify:bom:2279, line 1102 -->
<scope>compile</scope>
</dependency>
If I fully remove these two dependencies, they don't show up in the output.
from spring-cloud-gcp.
Now we can see that the Cloud SQL dependencies version is defined by com.spotify:bom:2279
. Can you update it to 1.16.0
or 1.17.1
(latest) ?
from spring-cloud-gcp.
Hm yeah I can look into that but it's strange that just specifying the version in my own project pom.xml wouldn't have been enough since usually that would override the older version being pulled in transitively
from spring-cloud-gcp.
@meltsufin can you please close this issue? Thanks!
from spring-cloud-gcp.
Related Issues (20)
- GCP PubSub Authorisation Issue In Java Using Service Account HOT 4
- Since 5.1.0 the warning "Application name is not set. Call Builder#setApplicationName." is logged HOT 8
- Spring Boot+datastore throws "Type must not be Null" when JsonNode is used as attribute on a Datastore Entity HOT 15
- secretmanager config import cause native image docker silently crash HOT 1
- Request for GenericTypeIndicator Support in spring-cloud-gcp-starter-data-firestore for Handling Generic Types
- TransportChannelProvider bean overwrites maxInboundMetadataSize with null HOT 3
- spring-cloud-gcp-dependencies BOM forces to use specific version of depenencies HOT 5
- codegen to allow hermetic build configs to setup optional googleapis version on library level
- Create a `.github/sync-repo-settings.yaml`
- Flaky alloydb integration test HOT 5
- Flaky pubsub integration test
- Flaky spanner integration test
- Flaky integration tests: Could not acquire locks HOT 1
- 5.2.0: Autoconfiguration of AlloyDB datasource is too aggressive HOT 1
- findFirst Derived Query Language Not Implemented
- Version 5.2.0 causes failure to start spring boot 3.2 application build with jdk 21. HOT 2
- spring-cloud-gcp-dependencies pom.xml should declare cloud-sql-connector-jdbc-sqlserver like it does with postgres-socket-factory and mysql-socket-factory-connector-j-8 HOT 3
- Flaky GoogleStorageIntegrationTests 404 Not Found
- Allow setting Expiration Policy on Subscriptions created via Pub Sub Binder HOT 5
- Generate Spring Auto-Configurations is failing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-gcp.