Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with Corda Flow #1167

Closed
shun-tak opened this issue Feb 28, 2020 · 2 comments
Closed

Doesn't work with Corda Flow #1167

shun-tak opened this issue Feb 28, 2020 · 2 comments
Labels
needs-review issue/PR needs review from maintainer

Comments

@shun-tak
Copy link

Issue_title

Run web3.ethSendTransaction(tx).send doesn't work in Corda

Issue_description

I tried to run web3j to send tx to Ethereum from Corda. However, it returned error like this

[INFO ] 2020-02-28T07:49:59,338Z [Node thread-1] corda.flow.run - Flow raised an error... sending it to flow hospital {actor_id=internalShell, actor_owning_identity=O=ParticipantA, L=London, C=GB, actor_store_id=NODE_CONFIG, fiber-id=10000001, flow-id=76edee53-897f-48ac-b1b1-776571a74313, invocation_id=3b6bc56b-9bee-4a78-b05a-46d18f3f08e4, invocation_timestamp=2020-02-28T07:49:59.025Z, origin=internalShell, session_id=128fc04e-ca5f-4980-9317-1753046cf745, session_timestamp=2020-02-28T07:49:58.807Z, thread-id=138}
java.lang.NoSuchMethodError: okhttp3.RequestBody.create(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;
	at org.web3j.protocol.http.HttpService.performIO(HttpService.java:154) ~[core-4.5.15.jar:?]
	at org.web3j.protocol.Service.send(Service.java:48) ~[core-4.5.15.jar:?]
	at org.web3j.protocol.core.Request.send(Request.java:87) ~[core-4.5.15.jar:?]
	at jp.co.layerx.cordage.flowethereumtx.Flow.call(Flow.kt:32) ~[?:?]
	at jp.co.layerx.cordage.flowethereumtx.Flow.call(Flow.kt:17) ~[?:?]

It seems okhttp3.RequestBody.create doesn't exist but I surely resolved dependencies. If it was not resolved, it should have returned NoSuchMethodError for web3j (this is confirmed).

I'm not sure but around Kotlin extension function may be a cause.

https://github.com/square/okhttp/blob/parent-4.3.1/okhttp/src/main/java/okhttp3/RequestBody.kt#L167-L175
https://github.com/web3j/web3j/blob/v4.5.15/core/src/main/java/org/web3j/protocol/http/HttpService.java#L154

Issue_context

  • Corda 4.0
  • web3j core 4.5.15
  • The unit test that is same as the code written in Cordapp passed

I would be grateful if someone commented on this.

@shun-tak shun-tak added the needs-review issue/PR needs review from maintainer label Feb 28, 2020
@antonydenyer
Copy link
Member

We upgraded the version of okhttp in https://github.com/web3j/web3j/releases/tag/v4.5.12 you can either use a version prior to this as it is using okhttp v3.8.1 which should be compatible with the okhttp version v3.5.0 which is what corda v4 pulls in.

@shun-tak
Copy link
Author

shun-tak commented Mar 3, 2020

web3j 4.5.11 worked very well with Corda Flow! Thank you for your great information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review issue/PR needs review from maintainer
Projects
None yet
Development

No branches or pull requests

2 participants