我正在尝试利用 apache camel-web3j 组件连接到本地 ganache 测试网节点:https ://github.com/apache/camel/blob/master/components/camel-web3j/src/main/docs/web3j-component .adoc
即使这没有正式发布,我也能够在本地构建它并作为本地依赖项包含在我的 maven 项目中。当我按照 github 网站上的说明进行操作时,我收到错误消息:
java.lang.RuntimeException: Provided file socket cannot be opened: 127.0.0.1:7545
at org.web3j.protocol.ipc.UnixDomainSocket.<init>(UnixDomainSocket.java:41)
at org.web3j.protocol.ipc.UnixDomainSocket.<init>(UnixDomainSocket.java:27)
at org.web3j.protocol.ipc.UnixIpcService.getIO(UnixIpcService.java:21)
at org.web3j.protocol.ipc.IpcService.performIO(IpcService.java:50)
at org.web3j.protocol.Service.send(Service.java:31)
at org.web3j.protocol.core.Request.send(Request.java:71)
at org.web3j.protocol.core.filters.BlockFilter.sendRequest(BlockFilter.java:24)
at org.web3j.protocol.core.filters.Filter.run(Filter.java:45)
at org.web3j.protocol.rx.JsonRpc2_0Rx.run(JsonRpc2_0Rx.java:73)
at org.web3j.protocol.rx.JsonRpc2_0Rx.lambda$ethBlockHashObservable$0(JsonRpc2_0Rx.java:46)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.subscribe(Observable.java:10238)
at rx.Observable.subscribe(Observable.java:10205)
at rx.Observable.subscribe(Observable.java:10086)
at org.apache.camel.component.web3j.Web3jConsumer.doStart(Web3jConsumer.java:100)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3518)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3835)
at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3771)
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3691)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3455)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3309)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:202)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3093)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3089)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3112)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3089)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3026)
at org.apache.camel.main.Main.doStart(Main.java:129)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.main.MainSupport.run(MainSupport.java:168)
at com.optum.propel.commons.startup.AppInit.startMicroService(AppInit.java:141)
at com.optum.propel.commons.startup.AppInit.lambda$main$0(AppInit.java:81)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: No such file or directory
at jnr.unixsocket.UnixSocketChannel.doConnect(UnixSocketChannel.java:127)
at jnr.unixsocket.UnixSocketChannel.connect(UnixSocketChannel.java:136)
at jnr.unixsocket.UnixSocketChannel.open(UnixSocketChannel.java:68)
at org.web3j.protocol.ipc.UnixDomainSocket.<init>(UnixDomainSocket.java:35)
... 38 common frames omitted
{ "date_time":"2018-06-13 17:04:48,617", "thread":"[Thread-2]", "log_level":"INFO ", "class_name":"Web3jConsumer", "log_message":"Subscribed: org.apache.camel.component.web3j.Web3jConfiguration@1f7fe1b2" }
{ "date_time":"2018-06-13 17:04:48,617", "thread":"[Thread-2]", "log_level":"INFO ", "class_name":"DefaultCamelContext", "log_message":"Route: rsRoute started and consuming from: web3j://127.0.0.1:7545?operation=BLOCK_OBSERVABLE" }
我很困惑,因为它首先抛出一个错误,然后说它成功连接。此外,当我将操作更改为ETH_GET_BLOCK_BY_HASH
它时,会引发不受支持的操作异常。
我想知道是否有人尝试使用此组件并看到问题?
我使用的端点是:
web3j://127.0.0.1:7545?operation=BLOCK_OBSERVABLE