GeezerVison is showing github.com — PubSub not returning any instance. · Issue #1510 · googleapis/google-cloud-java
PubSub not returning any instance. #1510DescriptionI'm using Cloud PubSub and trying to get access to the PubSub locally using Service Account JSON credential, but it is not returning anything. Below is the code I'm using to get PubSub instance. Neither it is throwing any exception nor it is returning any PubSub instance. This is an issue which needs to be resolved urgently, anyone can help me.
private PubSub getPubSubForLocal() {
PubSub pubSub = null;
InputStream inputStream = getClass().getResourceAsStream("/cloud/vostics-cloud-e56ac878e27e.json");
try {
pubSub = PubSubOptions.newBuilder()
.setCredentials(ServiceAccountCredentials.fromStream(inputStream))
.build()
.getService();
} catch (IOException e) {
return null;
} catch (Exception e) {
System.out.println(e.getMessage());
}
return pubSub;
}
Activitygarrettjonesgoogle commented on Jan 6, 2017 Is it throwing an IOException? Your code converts that to null. vaibhavsw commented on Jan 6, 2017 vaibhavsw commented on Jan 6, 2017 garrettjonesgoogle commented on Jan 6, 2017 So I think I need to understand what you mean by "it is not returning anything." Only one of the following is possible:
- The return value is
null
- The return value is a PubSub object
- An exception is thrown
- The JVM crashes such that the function didn't return
Which of those is happening? vaibhavsw commented on Jan 7, 2017 @garrettjonesgoogle Alright, this may sound weird because it does to me.
I've two applications in place and to make them communicate with each other I'm using PubSub, above code is common in both of the application to get an instance of PubSub. In one application it is giving below error:
07-Jan-2017 12:48:56.238 INFO [RMI TCP Connection(3)-127.0.0.1] io.grpc.internal.ManagedChannelImpl.<init> [ManagedChannelImpl@1d98cfab] Created with target pubsub.googleapis.com:443
In another application it is not returning anything, now when I'm saying it is not returning anything by that I mean that it is neither throwing any exception nor returning PubSub object.
I've tried debugging my code and when executing the code, IDE never reaches to any of the exception part. vaibhavsw commented on Jan 7, 2017 garrettjonesgoogle commented on Jan 9, 2017 Ok I think I should have included another possibility:
- One of the function calls hangs, so it never returns.
Can you use your debugger to step into the google-cloud-java code to see more specifically where it is hanging? vaibhavsw commented on Jan 10, 2017 @garrettjonesgoogle I've solved the previous issue, but now whenever I'm trying to get the topic or create the topic, it is giving me an error saying DEADLINE_EXCEDDED. garrettjonesgoogle commented on Jan 10, 2017
- I'm curious to know if you can say what caused your issue, in case others come across it.
- Generally DEADLINE_EXCEEDED is caused by the static netty-tcnative dependency not loading. See DEADLINE_EXCEEDED when using Cloud Pub/Sub library from Compute Engine #1430 for one particular example. I would need to know more about your environment to help you with that. Could you also turn on FINE logging and provide the library loading errors you see?
vaibhavsw commented on Jan 11, 2017 @garrettjonesgoogle
- It was the issue with my classpath, input stream wasn't able to find the JSON file.
- I've added nitty-all dependency in my project, but still error is there.
garrettjonesgoogle commented on Jan 26, 2017 @vaibhavswarnkar In order to help with # 2, could you provide the details of your environment (exact OS version & setup in particular), and errors that you see when you set the logging level to FINE? vaibhavsw commented on Jan 27, 2017 @garrettjonesgoogle My problem has been solved. I changed my Spring MVC app to Spring boot app and even after that it wasn't working then I changed the server to jetty server and it worked. garrettjonesgoogle commented on Jan 27, 2017 Great! Closing out issue now.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|