I'm trying to deploy a smart contract in java using web3j and Ganache. After the creation of the java wrapper for my contract, the code that I'm using to deploy the contract is:
public void deployGreeter(String pw, String walletFile, String _greeting) throws IOException, CipherException, Exception{
Credentials credentials = WalletUtils.loadCredentials(pw, walletFile);
Greeter g = Greeter.deploy(web3, credentials, ManagedTransaction.GAS_PRICE, Contract.GAS_LIMIT, _greeting).send();
}
But I'm getting the following error:
Exception in thread "main" java.lang.RuntimeException:
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source:
buffer(okhttp3.internal.http1.Http1Codec$ChunkedSource@10aa41f2).inputStream(); line: 1, column: 188] (through reference chain: org.web3j.protocol.core.methods.response.EthSendTransaction["error"]->org.web3j.protocol.core.Response$Error["data"])
at org.web3j.tx.Contract.deploy(Contract.java:302)
at org.web3j.tx.Contract.lambda$deployRemoteCall$5(Contract.java:334)
at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:30)
at com.monsanto.ethereumtest1.Ganache.deployGreeter(Ganache.java:125)
at com.monsanto.ethereumtest1.Main.main(Main.java:61)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
I've also tried to deploy another contract, but the error output is the same. Can someone tell me how to solve this?