簡體   English   中英

在 spring 啟動 2.6.1 中使用 spring-cloud-gcp-pub-sub-stream-binder 時未發現內部方法錯誤

[英]internal method not found error while using spring-cloud-gcp-pub-sub-stream-binder in spring boot 2.6.1

我正在嘗試將 spring-cloud-gcp-pub-sub-stream-binder 集成到我的 spring 啟動項目中,以使用來自 gcp pub 子主題的事件並在運行項目時出現以下錯誤。

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    com.google.cloud.spring.stream.binder.pubsub.provisioning.PubSubChannelProvisioner.provisionConsumerDestination(PubSubChannelProvisioner.java:81)

The following method did not exist:

    'boolean com.google.pubsub.v1.TopicName.isParsableFrom(java.lang.String)'

The calling method's class, com.google.cloud.spring.stream.binder.pubsub.provisioning.PubSubChannelProvisioner, was loaded from the following location:

    jar:file:/Users/pranay.garg/.m2/repository/com/google/cloud/spring-cloud-gcp-pubsub-stream-binder/3.3.0/spring-cloud-gcp-pubsub-stream-binder-3.3.0.jar!/com/google/cloud/spring/stream/binder/pubsub/provisioning/PubSubChannelProvisioner.class

The called method's class, com.google.pubsub.v1.TopicName, is available from the following locations:

    jar:file:/Users/pranay.garg/.m2/repository/com/google/api/grpc/proto-google-cloud-pubsub-v1/1.84.0/proto-google-cloud-pubsub-v1-1.84.0.jar!/com/google/pubsub/v1/TopicName.class

The called method's class hierarchy was loaded from the following locations:

    com.google.pubsub.v1.TopicName: file:/Users/pranay.garg/.m2/repository/com/google/api/grpc/proto-google-cloud-pubsub-v1/1.84.0/proto-google-cloud-pubsub-v1-1.84.0.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes com.google.cloud.spring.stream.binder.pubsub.provisioning.PubSubChannelProvisioner and com.google.pubsub.v1.TopicName

我正在使用 spring boot v2.6.1 和我的 dependencyManagement

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>libraries-bom</artifactId>
                <version>3.3.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>spring-cloud-gcp-dependencies</artifactId>
                <version>3.3.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2021.0.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

和我的相關依賴

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-pubsub-stream-binder</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-kafka</artifactId>
        </dependency

我認為這是版本兼容性問題,其中 PubSubChannelProvisioner 試圖調用 TopicName 中不存在的方法,但我無法找出解決方案。 如果您需要任何其他可能遺漏的信息,請告訴我。 任何幫助表示贊賞,謝謝。

我相信 sc-function 中的 GCP 適配器使用的是 proto-google-cloud-pubsub v1.0.0,而在您的情況下,您使用的是 1.84。 所以也許我們需要更新。 隨時提出問題 - https://github.com/spring-cloud/spring-cloud-function/issues

我在 spring-cloud-gcp github repo 上提出了問題並解決了問題。 原來是由於libraries-bom依賴管理版本解決方案中的版本沖突

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM