Open mnowrot opened 3 years ago
Please edit to include log between 2 lines for code formating "```"
like
13:42:56.234 [WebSocketConnectReadThread-139] INFO o.p.rpc.provider.ws.WsProvider - WebSocket onOpen: wss://rpc.polkadot.io/
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.polkadot.types.TypesUtils$1.newInstance(TypesUtils.java:103)
at org.polkadot.types.codec.CodecUtils.decodeU8a(CodecUtils.java:38)
at org.polkadot.types.codec.CodecUtils.decodeU8a(CodecUtils.java:44)
at org.polkadot.types.codec.CodecUtils.decodeU8a(CodecUtils.java:25)
at org.polkadot.types.codec.Struct.decodeStruct(Struct.java:69)
at org.polkadot.types.codec.Struct.<init>(Struct.java:37)
at org.polkadot.types.codec.Struct.<init>(Struct.java:46)
at org.polkadot.types.metadata.MetadataVersioned.<init>(MetadataVersioned.java:79)
at org.polkadot.types.metadata.Metadata.decodeMetadata(Metadata.java:29)
at org.polkadot.types.metadata.Metadata.<init>(Metadata.java:17)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.polkadot.types.TypesUtils$1.newInstance(TypesUtils.java:103)
at org.polkadot.types.codec.CreateType.createType(CreateType.java:237)
at org.polkadot.rpc.core.RpcCore.formatOutput(RpcCore.java:176)
at org.polkadot.rpc.core.RpcCore.access$200(RpcCore.java:37)
at org.polkadot.rpc.core.RpcCore$1.lambda$invoke$0(RpcCore.java:122)
at com.onehilltech.promises.OnResolvedExecutor.execute(OnResolvedExecutor.java:45)
at com.onehilltech.promises.OnResolvedExecutor.lambda$execute$0(OnResolvedExecutor.java:32)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IndexOutOfBoundsException: Index 13 out of bounds for length 4
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:459)
at org.polkadot.types.codec.EnumType.createValue(EnumType.java:130)
at org.polkadot.types.codec.EnumType.decodeViaValue(EnumType.java:88)
at org.polkadot.types.codec.EnumType.decodeEnumType(EnumType.java:80)
at org.polkadot.types.codec.EnumType.<init>(EnumType.java:37)
at org.polkadot.types.metadata.MetadataVersioned$MetadataEnum.<init>(MetadataVersioned.java:25)
... 28 more
java.lang.NullPointerException
at org.polkadot.types.codec.CodecUtils.decodeU8a(CodecUtils.java:42)
at org.polkadot.types.codec.CodecUtils.decodeU8a(CodecUtils.java:44)
at org.polkadot.types.codec.CodecUtils.decodeU8a(CodecUtils.java:25)
at org.polkadot.types.codec.Struct.decodeStruct(Struct.java:69)
at org.polkadot.types.codec.Struct.<init>(Struct.java:37)
at org.polkadot.types.codec.Struct.<init>(Struct.java:46)
at org.polkadot.types.metadata.MetadataVersioned.<init>(MetadataVersioned.java:79)
at org.polkadot.types.metadata.Metadata.decodeMetadata(Metadata.java:29)
at org.polkadot.types.metadata.Metadata.<init>(Metadata.java:17)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.polkadot.types.TypesUtils$1.newInstance(TypesUtils.java:103)
at org.polkadot.types.codec.CreateType.createType(CreateType.java:237)
at org.polkadot.rpc.core.RpcCore.formatOutput(RpcCore.java:176)
at org.polkadot.rpc.core.RpcCore.access$200(RpcCore.java:37)
at org.polkadot.rpc.core.RpcCore$1.lambda$invoke$0(RpcCore.java:122)
at com.onehilltech.promises.OnResolvedExecutor.execute(OnResolvedExecutor.java:45)
at com.onehilltech.promises.OnResolvedExecutor.lambda$execute$0(OnResolvedExecutor.java:32)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.polkadot.types.TypesUtils$1.newInstance(TypesUtils.java:103)
at org.polkadot.types.codec.CreateType.createType(CreateType.java:237)
at org.polkadot.rpc.core.RpcCore.formatOutput(RpcCore.java:176)
at org.polkadot.rpc.core.RpcCore.access$200(RpcCore.java:37)
at org.polkadot.rpc.core.RpcCore$1.lambda$invoke$0(RpcCore.java:122)
at com.onehilltech.promises.OnResolvedExecutor.execute(OnResolvedExecutor.java:45)
at com.onehilltech.promises.OnResolvedExecutor.lambda$execute$0(OnResolvedExecutor.java:32)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException
at org.polkadot.types.metadata.Metadata.decodeMetadata(Metadata.java:32)
at org.polkadot.types.metadata.Metadata.<init>(Metadata.java:17)
... 14 more
Please see above
I see,
Is there any way to get it working?
I wonder the same. As in mai example https://github.com/polkadot-java/api/blob/master/examples/src/main/java/org/polkadot/example/Staking.java#L68-L70
WsProvider wsProvider = new WsProvider(endPoint);
Promise<ApiPromise> ready = ApiPromise.create(wsProvider);
Well, I bet it will not run on newest v3.0 Substrate, see https://github.com/polkadot-java/api/issues/34
@mnowrot I wonder if you had to dance with gradle build, as I had to , see #35 Would you care to give a try?
See also https://github.com/polkadot-java/api/issues/34#issuecomment-914217953
@paulvi Thank you for your message. I've tried both fixing the build and polkaj, and finally settled for the TypeScript Polkadot API as polkaj implements only a small part of that API
OK, there are 3 APIs actually from ParityTech
see https://wiki.polkadot.network/docs/build-node-interaction
Substrate API Sidecar is actually using Polkadot-JS RPC API, so is actually usage example.
BTW, wss:// and not plain ws:// may be the issue, I have not noticed yet TLS related stuff, and could make TCP connect to ws://
An attempt to initialize the API produces the attached errors.
Initialization code:
Is there any way to get it working?
error.log