Search code examples
javaethereumweb3-java

Does Web3j require port forwarding to use?


I am trying to use web3j in java, but when i try to make a web3j object it gives an error

         Web3j web3j = Web3j.build(new HttpService());
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TreeNode

i think it's because port forwarding is not enabled, am i right ?


Solution

  • The error you are encountering is not related to port, but to a missing dependency:

    Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TreeNode

    This means that you are lacking the class com.fasterxml.jackson.core.TreeNode in your class path or module path.

    I don't know web3j but their site seems to references Maven or Gradle. You should try with those build tool since they will provide you the dependencies.