java.lang.ClassNotFoundException: okhttp3.CipherSuite at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.web3j.protocol.http.HttpService.(HttpService.java:46) at com.relay.eth.ERC20TokenUtil.(ERC20TokenUtil.java:36) at com.relay.controller.open.APIController.getETHTokensBalance(APIController.java:398) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at
Using web3j java library in a spring boot application,start the springboot project to access this,
Web3j web3j = Web3j.build(new HttpService("https://mainnet.infura.io/v3/{token}"))
And show error msg.
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>4.6.3</version>
<exclusions>
<exclusion>
<artifactId>okhttp</artifactId>
<groupId>com.squareup.okhttp3</groupId>
</exclusion>
</exclusions>
</dependency>
You should also add some crypto provider as a dependency to your project, just like it is stated in web3j docs :
It has five runtime dependencies:
...
- Bouncy Castle (Spongy Castle on Android) for crypto
...
i changed the pom dependency version
```<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>3.6.0</version>
</dependency>
```
delete the okhttp3 dependency
and its wokrs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.