Pranay Garg
Pranay Garg

Reputation: 21

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

I am trying to integrate spring-cloud-gcp-pub-sub-stream-binder in my spring boot project to consume events from gcp pub sub topic and getting the below error while running the project.

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

I am using spring boot v2.6.1 and my 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>

and my related dependencies

        <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

I think it's a version compatibility issue where PubSubChannelProvisioner is trying to call a method in TopicName which is not present but I am not able to figure out the solution for this. Let me know if you need any other information which might have been missed. Any help is appreciated, thanks.

Upvotes: 2

Views: 460

Answers (2)

Pranay Garg
Pranay Garg

Reputation: 21

I raised on issue on spring-cloud-gcp github repo and got the issue resolved. Turns out it was due to a version conflict in libraries-bom dependency management version solution

Upvotes: 0

Oleg Zhurakousky
Oleg Zhurakousky

Reputation: 6126

I believe GCP Adapter in s-c-function is using proto-google-cloud-pubsub v1.0.0 and in your case you are using 1.84. So perhaps we need to update. Feel free to raise an issue - https://github.com/spring-cloud/spring-cloud-function/issues

Upvotes: 1

Related Questions