Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pg30 opened this issue Aug 21, 2022 · 2 comments
Labels
priority: p3 type: question Further information is requested

Comments

@pg30
Copy link

pg30 commented Aug 21, 2022

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.

@zhumin8 zhumin8 added type: question Further information is requested priority: p3 labels Aug 22, 2022
@zhumin8
Copy link
Contributor

zhumin8 commented Aug 22, 2022

In dependencyManagement, libraries-bom version are already specified in spring-cloud-gcp-dependencies here, so you do not need to specify it separately. In your case, you used a 3.3.0 version for libraries-bom where the current version is 26.0.0, thus client library methods could not be found.
You can refer to our sample application for examples of setting up dependencies.

@pg30
Copy link
Author

pg30 commented Aug 23, 2022

Thanks for your help @zhumin8 , it worked

@pg30 pg30 closed this as completed Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants