-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
java.lang.NullPointerException is displayed when CloudTasksClient.create() #10804
Comments
Can you provide more information about your dependencies (perhaps provide your pom.xml/ build.gradle file)? Running this locally for me works. |
this is my pom.xml
|
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) { with this as well its not working |
There error is most likely due to how we resolve the endpoint. I see your dependencies are a bit old and it is probably due to a combo of old client library + new runtime library and the is unable to determine the endpoint. Can you try and change your pom.xml to use the latest libraries-bom and let us know if that works? i.e.
|
I tried with latest bom its not working
|
You're declaring it in the Additionally, you are also specifying the versions and not letting the bom set the versions for you:
It should be
once you add in the bom |
@lqiu96 Its now worked like CHarm Thank you |
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.lastIndexOf(int)" because "endpoint" is null
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.validateEndpoint(InstantiatingGrpcChannelProvider.java:746)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.withEndpoint(InstantiatingGrpcChannelProvider.java:195)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:199)
at com.google.cloud.tasks.v2.stub.GrpcCloudTasksStub.create(GrpcCloudTasksStub.java:254)
at com.google.cloud.tasks.v2.stub.CloudTasksStubSettings.createStub(CloudTasksStubSettings.java:407)
at com.google.cloud.tasks.v2.CloudTasksClient.(CloudTasksClient.java:533)
at com.google.cloud.tasks.v2.CloudTasksClient.create(CloudTasksClient.java:516)
at com.google.cloud.tasks.v2.CloudTasksClient.create(CloudTasksClient.java:508)
Environment details
General, Core, and Other are also allowed as types : CloudTasksClient.create()
com.google.cloud
google-cloud-tasks
2.42.0
Steps to reproduce
CloudTasksClient client = CloudTasksClient.create()
Code example
// example
CloudTasksClient client = CloudTasksClient.create()
Stack trace
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.lastIndexOf(int)" because "endpoint" is null
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.validateEndpoint(InstantiatingGrpcChannelProvider.java:746)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.withEndpoint(InstantiatingGrpcChannelProvider.java:195)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:199)
at com.google.cloud.tasks.v2.stub.GrpcCloudTasksStub.create(GrpcCloudTasksStub.java:254)
at com.google.cloud.tasks.v2.stub.CloudTasksStubSettings.createStub(CloudTasksStubSettings.java:407)
at com.google.cloud.tasks.v2.CloudTasksClient.(CloudTasksClient.java:533)
at com.google.cloud.tasks.v2.CloudTasksClient.create(CloudTasksClient.java:516)
at com.google.cloud.tasks.v2.CloudTasksClient.create(CloudTasksClient.java:508)
External references such as API reference guides
Any additional information below
Following these steps guarantees the quickest resolution possible.
Thanks!
The text was updated successfully, but these errors were encountered: