Java gRPC proto issue #6799
Replies: 9 comments
-
Did you generate the java proto classes first? By default You can find more info about how to configure it for gradel/maven here If not you can edit the
remember to install the |
Beta Was this translation helpful? Give feedback.
-
You could also use the LightningJ library which compiles them for you. |
Beta Was this translation helpful? Give feedback.
-
I already had the things in the pom.xml and the proto file compiles just fine (in java). This is the LightningGrpc.java file that gets compiled: https://pastebin.com/0Etqq4ti Some of the methods in the proto file are present (lnrpc.LightningGrpc & lnrpc.LightningGrpc.LightningBlockingStub), however the Rpc methods are absent. Would you be able to try it yourself and see if the issue is with me or the proto file? |
Beta Was this translation helpful? Give feedback.
-
I'll take a look at this, but I think that connecting to the gRPC API directly may still be useful for me. |
Beta Was this translation helpful? Give feedback.
-
It's possible that things are out of date. We accept updates to the documentation periodically to keep things up to date, but we're mostly dependent on the community/contributors for that, since we don't use all these languages in production ourselves. The last update to this section by a contributor was a bit over a year ago: #5094. |
Beta Was this translation helpful? Give feedback.
-
That allows you to connect to the gRPC API directly. LightningJ is just a packaged up version of the compiled protos, so just the step you're currently struggling with. |
Beta Was this translation helpful? Give feedback.
-
I see, I tried to use LightningJ and just copying over the example class seems to cause Runtime errors. |
Beta Was this translation helpful? Give feedback.
-
You could have a look at https://github.com/C-Otto/lnd-manageJ/tree/main/grpc-client. Maybe |
Beta Was this translation helpful? Give feedback.
-
There is a scala version in bitcoin-s if this will help as well |
Beta Was this translation helpful? Give feedback.
-
Background
Following the Java tutorial here: https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/java.md
I have followed all the steps and following imports from the example Main.java are missing:
import lnrpc.Rpc.GetInfoRequest;
import lnrpc.Rpc.GetInfoResponse;
Your environment
Maven, pom.xml & file structure is replica of https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/java.md
Steps to reproduce
Copy https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/java.md exactly and you won't be able to import those 2 methods.
Expected behaviour
Those methods should import when the proto file is compiled into Java.
(Maybe the lightning.proto file included in https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/java.md isn't correct?)
Actual behaviour
The lnrpc.Rpc.GetInfoRequest & lnrpc.Rpc.GetInfoReponse don't exist. As a matter if fact, there is no lnrpc.Rpc class that is compiled.
Beta Was this translation helpful? Give feedback.
All reactions