2

so a few weeks ago I created a java wrapper object with web3j for a smart contract and was able to work with it with no problems. following exactly what I did a few weeks ago I keep getting a JsonParseException now without changing anything. The command I am using: web3j solidity generate --javaTypes greeter_sol_Greeter.abi greeter_sol_Greeter.bin -o src/main/java -p com.example.ethgreeter

and the error I am getting is:

Exception in thread "main" com.fasterxml.jackson.core.JsonParseException: Unexpected character ('f' (code 102)): Expected space separating root-level values
 at [Source: greeter_sol_Greeter.bin; line: 1, column: 32]
        at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportMissingRootWS(ParserMinimalBase.java:503)
        at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._verifyRootSpace(UTF8StreamJsonParser.java:1689)
        at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._parsePosNumber(UTF8StreamJsonParser.java:1426)
        at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:876)
        at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:772)
        at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3834)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3783)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2740)
        at org.web3j.codegen.SolidityFunctionWrapperGenerator.loadContractDefinition(SolidityFunctionWrapperGenerator.java:93)
        at org.web3j.codegen.SolidityFunctionWrapperGenerator.generate(SolidityFunctionWrapperGenerator.java:116)
        at org.web3j.codegen.SolidityFunctionWrapperGenerator.main(SolidityFunctionWrapperGenerator.java:87)
        at org.web3j.codegen.SolidityFunctionWrapperGenerator.run(SolidityFunctionWrapperGenerator.java:48)
        at org.web3j.console.Runner.main(Runner.java:38)

Does anyone have any clue why this could have started happening out of the blue? I am using web3j version 3.4.0, it is the same version I used a couple of weeks ago and it seems to be the latest version still. Here is a link for web3j documentation

  • 1
    It was really a simple solution I feel a little embarrassed but just in case anyone runs into the same issue: when doing the command switch the abi and bin files so its like this: web3j solidity generate --javaTypes <file name>.bin <file name>.abi -o src/main/java -p com.example.ethgreeter – Mr.O Jun 7 '18 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.