Exception paying an invoice using the synchronous API
Closed this issue · 5 comments
Couldn't find this in the documentation, so I figured I'd ask here.
I'm trying to pay an invoice using the synchronous API. I'm creating an empty SendRequest object, setting the payment request string, and passing that to .sendPaymentSync
. Basically (the Clojure equivalent of) this:
api.sendPaymentSync(SendRequest().setPaymentRequest("lnsb10n1pdw6wbdpp5aq9jhyc4sk227qpu2czfmwfldpe3wvsfucqg6t3ny41zrlx09s2qdqqcqzysu2gc2Xwq2fn6sxcw5njr0qdrxfq2yn05mvgyv5dy9cbdnj9py54zar87k36t88u4yrc9pc7dg20ntzq33r7y7l5p0pne3p8qcdyk53gp9l3x2e"))
Getting this error:
#error {
:cause "org.lightningj.lnd.proto.LightningApi$Hop.parseUnknownFieldProto3(Lcom/google/protobuf/CodedInputStream;Lcom/google/protobuf/UnknownFieldSet$Builder;Lcom/google/protobuf/ExtensionRegistryLite;I)Z"
:via
[{:type org.lightningj.lnd.wrapper.ClientSideException
:message "CANCELLED: Failed to read message."
:at [org.lightningj.lnd.wrapper.StatusExceptionWrapper wrap "StatusExceptionWrapper.java" 69]}
{:type io.grpc.StatusRuntimeException
:message "CANCELLED: Failed to read message."
:at [io.grpc.stub.ClientCalls toStatusRuntimeException "ClientCalls.java" 210]}
{:type java.lang.NoSuchMethodError
:message "org.lightningj.lnd.proto.LightningApi$Hop.parseUnknownFieldProto3(Lcom/google/protobuf/CodedInputStream;Lcom/google/protobuf/UnknownFieldSet$Builder;Lcom/google/protobuf/ExtensionRegistryLite;I)Z"
:at [org.lightningj.lnd.proto.LightningApi$Hop <init> "LightningApi.java" 45676]}]
:trace
[[org.lightningj.lnd.proto.LightningApi$Hop <init> "LightningApi.java" 45676]
[org.lightningj.lnd.proto.LightningApi$Hop <init> "LightningApi.java" 45637]
[org.lightningj.lnd.proto.LightningApi$Hop$1 parsePartialFrom "LightningApi.java" 46318]
[org.lightningj.lnd.proto.LightningApi$Hop$1 parsePartialFrom "LightningApi.java" 46313]
[com.google.protobuf.CodedInputStream readMessage "CodedInputStream.java" 497]
[org.lightningj.lnd.proto.LightningApi$Route <init> "LightningApi.java" 46506]
[org.lightningj.lnd.proto.LightningApi$Route <init> "LightningApi.java" 46441]
[org.lightningj.lnd.proto.LightningApi$Route$1 parsePartialFrom "LightningApi.java" 47544]
[org.lightningj.lnd.proto.LightningApi$Route$1 parsePartialFrom "LightningApi.java" 47539]
[com.google.protobuf.CodedInputStream readMessage "CodedInputStream.java" 497]
[org.lightningj.lnd.proto.LightningApi$SendResponse <init> "LightningApi.java" 7595]
[org.lightningj.lnd.proto.LightningApi$SendResponse <init> "LightningApi.java" 7537]
[org.lightningj.lnd.proto.LightningApi$SendResponse$1 parsePartialFrom "LightningApi.java" 8265]
[org.lightningj.lnd.proto.LightningApi$SendResponse$1 parsePartialFrom "LightningApi.java" 8260]
...
Any tips on debugging? Thanks in advance!
Thanks! Let me know if you need any more information to repro.
Hi again
I have looked at this issue quickly and I don't get the same error when trying:
SendRequest request = new SendRequest();
request.setPaymentRequest("lntb25u1pdwutr9pp5y4plra8az4krdlzlxs3wgalldsce3sg80hlg9fkwcfsxr6lg7drsdpdfahx2grsd3shjgrxdaezqstnw3jhymmfvssy66twv4e8xcqzysxqrrssxdz7ykanxv6nc0p6ma24apwygvrp0fmwx88270kufyunpnwgtn2hcqd9jdahssh6k7fw8f7x09mkp2js58zsa5g6euxawaqqvdggzhqpm9g07w");
System.out.println(synchronousLndAPI.sendPaymentSync(request).toJsonAsString(true));
I get error of not enough founded route with was expected since I have had some problems with my channels lately (but not connected to this issue).
What I found on internet that the MethodNotFound error could happen if there was muliple protobuf on the class path: see protocolbuffers/protobuf#3499
Can you check your classpath that correct libraries are linked? List of current dependencies in the project are found here: http://www.lightningj.org/dependencies/root.html
Thanks taking a look and for the tip on a possible classpath problem. This is the dependency list for lightningj according to leiningen
, Clojure's build tool:
[org.lightningj/lightningj "0.4.1-Beta"]
[com.google.api.grpc/googleapis-common-protos "0.0.3"]
[com.google.protobuf/protobuf-java "3.0.0"]
[io.grpc/grpc-netty "1.7.0"]
[io.grpc/grpc-core "1.7.0"]
[com.google.code.findbugs/jsr305 "3.0.0"]
[com.google.errorprone/error_prone_annotations "2.0.19"]
[com.google.instrumentation/instrumentation-api "0.4.3" :exclusions [[com.google.errorprone/error_prone_annotations] [io.grpc/grpc-context]]]
[io.grpc/grpc-context "1.7.0"]
[io.opencensus/opencensus-api "0.6.0" :exclusions [[com.google.code.findbugs/jsr305] [com.google.errorprone/error_prone_annotations] [io.grpc/grpc-context]]]
[io.netty/netty-codec-http2 "4.1.16.Final"]
[io.netty/netty-codec-http "4.1.16.Final"]
[io.netty/netty-codec "4.1.16.Final"]
[io.netty/netty-handler "4.1.16.Final"]
[io.netty/netty-buffer "4.1.16.Final"]
[io.netty/netty-common "4.1.16.Final"]
[io.netty/netty-handler-proxy "4.1.16.Final"]
[io.netty/netty-codec-socks "4.1.16.Final"]
[io.netty/netty-transport "4.1.16.Final"]
[io.netty/netty-resolver "4.1.16.Final"]
[io.grpc/grpc-protobuf "1.7.0"]
[com.google.api.grpc/proto-google-common-protos "0.1.9" :exclusions [[com.google.protobuf/protobuf-java] [com.google.api/api-common]]]
[com.google.guava/guava "19.0"]
[com.google.protobuf/protobuf-java-util "3.4.0"]
[com.google.code.gson/gson "2.7"]
[io.grpc/grpc-protobuf-lite "1.7.0" :exclusions [[com.google.protobuf/protobuf-lite]]]
[io.grpc/grpc-stub "1.7.0"]
[io.netty/netty-tcnative-boringssl-static "2.0.6.Final"]
[org.glassfish/javax.json "1.1.2"]
And I did get a few warnings while generating the dependency list:
$ lein deps :tree > deps
WARNING!!! version ranges found for:
[org.lightningj/lightningj "0.4.1-Beta"] -> [io.grpc/grpc-netty "1.7.0"] -> [io.grpc/grpc-core "[1.7.0,1.7.0]"]
Consider using [org.lightningj/lightningj "0.4.1-Beta" :exclusions [io.grpc/grpc-core]].
[org.lightningj/lightningj "0.4.1-Beta"] -> [io.grpc/grpc-netty "1.7.0"] -> [io.netty/netty-codec-http2 "[4.1.16.Final,4.1.16.Final]"]
Consider using [org.lightningj/lightningj "0.4.1-Beta" :exclusions [io.netty/netty-codec-http2]].
Possibly confusing dependencies found:
[org.lightningj/lightningj "0.4.1-Beta"] -> [com.google.api.grpc/googleapis-common-protos "0.0.3"] -> [com.google.protobuf/protobuf-java "3.0.0"]
overrides
[org.lightningj/lightningj "0.4.1-Beta"] -> [io.grpc/grpc-protobuf "1.7.0"] -> [com.google.protobuf/protobuf-java-util "3.4.0"] -> [com.google.protobuf/protobuf-java "3.4.0"]
and
[org.lightningj/lightningj "0.4.1-Beta"] -> [io.grpc/grpc-protobuf "1.7.0"] -> [com.google.protobuf/protobuf-java "3.4.0"]
Consider using these exclusions:
[org.lightningj/lightningj "0.4.1-Beta" :exclusions [com.google.protobuf/protobuf-java]]
[org.lightningj/lightningj "0.4.1-Beta" :exclusions [com.google.protobuf/protobuf-java]]
I'm surprised that leiningen
generates a different dependency list than gradle
, will need to investigate more.
Solved! Needed to include an extra dependency to fix version ranges for protobuf-java (3.0.0->3.4.0)
.
[com.google.protobuf/protobuf-java "3.4.0"]
I'm not completely sure why it works differently in clojure vs plain java, but at least my issue is resolved for now.
I found the version range conflict by comparing gradle's dependency tree with leiningen's dependency tree.
$ gradle dependencies --configuration runtime
...
\--- org.lightningj:lightningj:0.4.1-Beta
+--- com.google.api.grpc:googleapis-common-protos:0.0.3
| +--- com.google.protobuf:protobuf-java:3.0.0 -> 3.4.0
| +--- io.grpc:grpc-stub:0.15.0 -> 1.7.0
| | \--- io.grpc:grpc-core:1.7.0
| | +--- io.grpc:grpc-context:1.7.0
| | +--- com.google.guava:guava:19.0
| | +--- com.google.errorprone:error_prone_annotations:2.0.19
| | +--- com.google.code.findbugs:jsr305:3.0.0
| | +--- com.google.instrumentation:instrumentation-api:0.4.3
| | | +--- com.google.code.findbugs:jsr305:3.0.0
| | | \--- com.google.guava:guava:19.0
| | \--- io.opencensus:opencensus-api:0.6.0
| | \--- com.google.guava:guava:19.0
| \--- io.grpc:grpc-protobuf:0.15.0 -> 1.7.0
| +--- io.grpc:grpc-core:1.7.0 (*)
| +--- com.google.protobuf:protobuf-java:3.4.0
| +--- com.google.guava:guava:19.0
| +--- com.google.protobuf:protobuf-java-util:3.4.0
| | +--- com.google.protobuf:protobuf-java:3.4.0
| | +--- com.google.guava:guava:19.0
| | \--- com.google.code.gson:gson:2.7
| +--- com.google.api.grpc:proto-google-common-protos:0.1.9
| \--- io.grpc:grpc-protobuf-lite:1.7.0
| +--- io.grpc:grpc-core:1.7.0 (*)
| \--- com.google.guava:guava:19.0
+--- io.netty:netty-tcnative-boringssl-static:2.0.6.Final
+--- io.grpc:grpc-netty:1.7.0
| +--- io.grpc:grpc-core:[1.7.0] -> 1.7.0 (*)
| +--- io.netty:netty-codec-http2:[4.1.16.Final] -> 4.1.16.Final
| | +--- io.netty:netty-codec-http:4.1.16.Final
| | | \--- io.netty:netty-codec:4.1.16.Final
| | | \--- io.netty:netty-transport:4.1.16.Final
| | | +--- io.netty:netty-buffer:4.1.16.Final
| | | | \--- io.netty:netty-common:4.1.16.Final
| | | \--- io.netty:netty-resolver:4.1.16.Final
| | | \--- io.netty:netty-common:4.1.16.Final
| | \--- io.netty:netty-handler:4.1.16.Final
| | +--- io.netty:netty-buffer:4.1.16.Final (*)
| | +--- io.netty:netty-transport:4.1.16.Final (*)
| | \--- io.netty:netty-codec:4.1.16.Final (*)
| \--- io.netty:netty-handler-proxy:4.1.16.Final
| +--- io.netty:netty-transport:4.1.16.Final (*)
| +--- io.netty:netty-codec-socks:4.1.16.Final
| | \--- io.netty:netty-codec:4.1.16.Final (*)
| \--- io.netty:netty-codec-http:4.1.16.Final (*)
+--- io.grpc:grpc-protobuf:1.7.0 (*)
+--- io.grpc:grpc-stub:1.7.0 (*)
+--- javax.json:javax.json-api:1.0 -> 1.1.2
\--- org.glassfish:javax.json:1.1.2
\--- javax.json:javax.json-api:1.1.2
Thanks for your help.