polkadot-java / api

Java APIs around Polkadot and any Substrate-based chain RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.Full documentation & examples available.
https://polkadot-java.github.io/
Apache License 2.0
61 stars 28 forks source link

When I run example ,there has an error!!! #19

Closed ruanqunfeng closed 5 years ago

ruanqunfeng commented 5 years ago

java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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.(Struct.java:37) at org.polkadot.types.codec.Struct.(Struct.java:46) at org.polkadot.types.metadata.MetadataVersioned.(MetadataVersioned.java:80) at org.polkadot.types.metadata.Metadata.decodeMetadata(Metadata.java:30) at org.polkadot.types.metadata.Metadata.(Metadata.java:18) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IndexOutOfBoundsException: Index: 7, Size: 4 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at org.polkadot.types.codec.EnumType.createValue(EnumType.java:131) at org.polkadot.types.codec.EnumType.decodeViaValue(EnumType.java:89) at org.polkadot.types.codec.EnumType.decodeEnumType(EnumType.java:81) at org.polkadot.types.codec.EnumType.(EnumType.java:38) at org.polkadot.types.metadata.MetadataVersioned$MetadataEnum.(MetadataVersioned.java:26) ... 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.(Struct.java:37) at org.polkadot.types.codec.Struct.(Struct.java:46) at org.polkadot.types.metadata.MetadataVersioned.(MetadataVersioned.java:80) at org.polkadot.types.metadata.Metadata.decodeMetadata(Metadata.java:30) at org.polkadot.types.metadata.Metadata.(Metadata.java:18) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 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.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at org.polkadot.types.metadata.Metadata.decodeMetadata(Metadata.java:33) at org.polkadot.types.metadata.Metadata.(Metadata.java:18) ... 14 more java.lang.NullPointerException at org.polkadot.api.ApiBase.lambda$loadMeta$3(ApiBase.java:304) at com.onehilltech.promises.OnResolvedExecutor.execute(OnResolvedExecutor.java:45) at com.onehilltech.promises.OnResolvedExecutor.lambda$execute$0(OnResolvedExecutor.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

wangboy commented 5 years ago

the substrate version of java api is 1.0.0-41ccb19c-x86_64-macos, you can check your substrate version