Giter VIP home page Giter VIP logo

web3j-spring-boot-starter's Introduction

web3j Spring Boot Starter

Build Status

Integrate web3j into your Spring Boot applications via Spring's dependency injection.

Getting started

A sample application is available here

To use, create a new Spring Boot Application, and include the following dependencies:

Maven:

<dependency>
    <groupId>org.web3j</groupId>
    <artifactId>web3j-spring-boot-starter</artifactId>
    <version>4.0.3</version>
</dependency>

Gradle:

compile ('org.web3j:web3j-spring-boot-starter:4.0.3')

Now Spring can inject web3j instances for you where ever you need them:

@Autowired
private Web3j web3j;

No additional configuration is required if you want to connect via HTTP to the default URL http://localhost:8545.

Otherwise simply add the address of the endpoint in your application properties:

# An infura endpoint
web3j.client-address = https://rinkeby.infura.io/

# Or, an IPC endpoing
web3j.client-address = /path/to/file.ipc

Admin clients

If you wish to make use of the personal module methods that are common to both Parity and Geth
to manage accounts, enable the admin client:

web3j.admin-client = true

Then Spring can inject admin clients:

@Autowired
private Admin admin;

HTTP client configuration

Some Ethereum operations take longer than the default HTTP timeout set by the OkHttp3 library used by web3j. To configure those timeouts set the web3j httpTimeoutSeconds property:

web3j.httpTimeoutSeconds = 600  

This sets all three OkHttp3 timeouts: connect, read, and write.

Valid values are any non-negative integer.

A value of '0' means: no timeout.

Note: This is not required for transacting with web3j.

Further information

For further information on web3j, please refer to the web3j home page.

web3j-spring-boot-starter's People

Contributors

conor10 avatar eepstein avatar ganchix avatar snazha-blkio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

web3j-spring-boot-starter's Issues

Gradle not see dependency

Hi, in a my class, i do:
@Autowired private Web3j web3j;
in the build.gradle i put this row:
compile ('org.web3j:web3j-spring-boot-starter:4.0.3')
but i still see the error of the class web3 that not exist

Application Startup issue (java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy) with Spring boot 2.0.1.RELEASE

When i try to run the application with spring boot 2.0.1.RELEASE , the following error appears. This error appears just after importing the maven dependency without any code for web3j.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-04-18 01:49:16.133 ERROR 9406 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
	at com.inerg.demo_poc.DemoApplication.main(DemoApplication.java:27) [classes/:na]
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at java.base/sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:na]
	at java.base/sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:na]
	at java.base/sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:na]
	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:na]
	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:na]
	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:na]
	at java.base/java.lang.Class.createAnnotationData(Class.java:3710) ~[na:na]
	at java.base/java.lang.Class.annotationData(Class.java:3699) ~[na:na]
	at java.base/java.lang.Class.createAnnotationData(Class.java:3715) ~[na:na]
	at java.base/java.lang.Class.annotationData(Class.java:3699) ~[na:na]
	at java.base/java.lang.Class.getAnnotation(Class.java:3604) ~[na:na]
	at java.base/java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:274) ~[na:na]
	at java.base/java.lang.Class.isAnnotationPresent(Class.java:3614) ~[na:na]
	at org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:573) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:177) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:217) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:188) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:129) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1761) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	... 16 common frames omitted


Process finished with exit code 1

OkHttp client times out

The newer version of OkHttp3 has socket (and other) timeout settings of 10s by default.
It'd be useful for those to be configurable when folks are using this spring-boot starter.

ETA on new release?

Hi @conor10,

I saw that the 3.3.1 release is available for web3j. Congrats on getting that out.

Any estimated time for the next release of the web3j-spring-boot-starter library?

Thanks!

web3j version in starter is outdated

The latest version of this spring boot starter links to web3j version 3.3.1, which is quite old. If I install the command line tools on my mac via brew install, the code generator in the command line client is not compatible with the web3j version in the spring boot starter. Is this something that could be updated?

Implement /actuator/info endpoint

I was greatly surprised to see that /actuator/health is implemented ;-)

$ curl http://127.0.0.1:8080/actuator/health
{"status":"UP",
  "components":{   
     "diskSpace":{"status":"UP","details" {"total":73867264000,"free":4643659776,"threshold":10485760}},
     "ping":{"status":"UP"},
     "web3j":{"status":"UP","details":{"clientVersion":"Autonity/v0.3.0-de53f1f3/linux-amd64/go1.11.13","netVersion":"1","blockNumber":79902,"protocolVersion":"0x3f","netPeerCount":4}}
}}

Would it make sense to implement also the info endpoint? (in fact I would probably move most of the output to the info endpoint instead of the health endpoint, but it is just an opinion)

https://github.com/web3j/web3j-spring-boot-starter/blob/master/src/main/java/org/web3j/spring/actuate/Web3jHealthIndicator.java

Just in case anyone bumps into this issue, my workaround implementing the info actuator so far is:

@Component
public class Web3jInfoContributor implements InfoContributor {
    @Autowired
    HealthContributorRegistry registry;

    @Override
    public void contribute(Builder builder) {
        Map<String, Object> web3jhealthinfo = registry.stream().
                // Work only on the web3j HealthContributor
                filter(x -> (x.getName().equals("web3j") && x.getContributor() instanceof HealthIndicator)).
                // Get the HealthIndicator from the HealthContributor
                map(x -> ((HealthIndicator) x.getContributor()).
                // Get Health->Details->Map<String,Object>
                        health().getDetails())
                .findFirst().orElse(null);

        builder.withDetail("web3j", web3jhealthinfo);
    }
}

websocket connect error

I set web3j.client-address=ws://localhost:8546
run the program to get the following error , but retry in command line: geth attach ws://localhost:8546,It is ok.
it need some more setting? which document can tell us ? thanks
java.lang.RuntimeException: Provided file socket cannot be opened: ws://localhost:8546

java.lang.IllegalStateException: Failed to execute ApplicationRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:774) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:761) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:319) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
at com.ljd.UacExecutor.UacExecutorApplication.main(UacExecutorApplication.java:14) [classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [uac-executor-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [uac-executor-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [uac-executor-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [uac-executor-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.RuntimeException: Provided file socket cannot be opened: ws://localhost:8546
at org.web3j.protocol.ipc.UnixDomainSocket.(UnixDomainSocket.java:41) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.ipc.UnixDomainSocket.(UnixDomainSocket.java:27) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.ipc.UnixIpcService.getIO(UnixIpcService.java:21) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.ipc.IpcService.performIO(IpcService.java:33) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.Service.send(Service.java:34) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.core.Request.send(Request.java:72) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.core.filters.LogFilter.sendRequest(LogFilter.java:31) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.core.filters.Filter.run(Filter.java:51) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.rx.JsonRpc2_0Rx.run(JsonRpc2_0Rx.java:73) ~[core-4.2.0.jar!/:na]
at org.web3j.protocol.rx.JsonRpc2_0Rx.lambda$ethLogFlowable$2(JsonRpc2_0Rx.java:65) ~[core-4.2.0.jar!/:na]
at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:71) ~[rxjava-2.2.11.jar!/:na]
at io.reactivex.Flowable.subscribe(Flowable.java:14918) ~[rxjava-2.2.11.jar!/:na]
at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37) ~[rxjava-2.2.11.jar!/:na]
at io.reactivex.Flowable.subscribe(Flowable.java:14918) ~[rxjava-2.2.11.jar!/:na]
at io.reactivex.internal.operators.flowable.BlockingFlowableIterable.iterator(BlockingFlowableIterable.java:42) ~[rxjava-2.2.11.jar!/:na]
at com.ljd.UacExecutor.myLinster.startWatch(myLinster.java:97) ~[classes!/:0.0.1-SNAPSHOT]
at com.ljd.UacExecutor.myLinster.run(myLinster.java:39) ~[classes!/:0.0.1-SNAPSHOT]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771) [spring-boot-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
... 13 common frames omitted
Caused by: java.io.IOException: No such file or directory
at jnr.unixsocket.UnixSocketChannel.doConnect(UnixSocketChannel.java:127) ~[jnr-unixsocket-0.21.jar!/:na]
at jnr.unixsocket.UnixSocketChannel.connect(UnixSocketChannel.java:136) ~[jnr-unixsocket-0.21.jar!/:na]
at jnr.unixsocket.UnixSocketChannel.open(UnixSocketChannel.java:68) ~[jnr-unixsocket-0.21.jar!/:na]
at org.web3j.protocol.ipc.UnixDomainSocket.(UnixDomainSocket.java:35) ~[core-4.2.0.jar!/:na]
... 30 common frames omitted

okhttp dependency conflict

I recently upgraded my project to version 4.5.16 of web3j and now I am getting the following error:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.web3j.protocol.http.HttpService.performIO(HttpService.java:154)

The following method did not exist:

okhttp3.RequestBody.create(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;

The method's class, okhttp3.RequestBody, is available from the following locations:

jar:file:/home/usuario/.m2/repository/com/squareup/okhttp3/okhttp/3.14.4/okhttp-3.14.4.jar!/okhttp3/RequestBody.class

It was loaded from the following location:

file:/home/usuario/.m2/repository/com/squareup/okhttp3/okhttp/3.14.4/okhttp-3.14.4.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of okhttp3.RequestBody

Make springBoot version configurable

Springboot library changes faster than this library. And since there is not much springboot specific we should be able to specify the springbot version the project uses instead of hardcode that dependency

Setting web3j.httpTimeoutSeconds to 0 still results in a timeout

I've configured the property web3j.httpTimeoutSeconds to 0. According to the documentation this will result in no timeout. However I still get a timeout, if the parity node is not responding fast enough:

2018-05-02 10:59:48.450 ERROR 1 --- [pool-6-thread-2] org.web3j.protocol.core.filters.Filter   : Error sending request

org.web3j.protocol.core.filters.FilterException: Error sending request
        at org.web3j.protocol.core.filters.Filter.throwException(Filter.java:156) ~[core-3.3.1.jar!/:na]
        at org.web3j.protocol.core.filters.Filter.pollFilter(Filter.java:110) ~[core-3.3.1.jar!/:na]
        at org.web3j.protocol.core.filters.Filter.lambda$run$0(Filter.java:75) ~[core-3.3.1.jar!/:na]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_151]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[na:1.8.0_151]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_151]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[na:1.8.0_151]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_151]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_151]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_151]
Caused by: java.net.ConnectException: Failed to connect to **MY_IP_HERE**:8545
        at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:225) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:149) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:195) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.RealCall.execute(RealCall.java:69) ~[okhttp-3.8.1.jar!/:na]
        at org.web3j.protocol.http.HttpService.performIO(HttpService.java:104) ~[core-3.3.1.jar!/:na]
        at org.web3j.protocol.Service.send(Service.java:31) ~[core-3.3.1.jar!/:na]
        at org.web3j.protocol.core.Request.send(Request.java:71) ~[core-3.3.1.jar!/:na]
        at org.web3j.protocol.core.filters.Filter.pollFilter(Filter.java:108) ~[core-3.3.1.jar!/:na]
        ... 8 common frames omitted
Caused by: java.net.ConnectException: Operation timed out (Connection timed out)
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_151]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_151]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_151]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_151]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_151]
        at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_151]
        at okhttp3.internal.platform.Platform.connectSocket(Platform.java:124) ~[okhttp-3.8.1.jar!/:na]
        at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:223) ~[okhttp-3.8.1.jar!/:na]
        ... 29 common frames omitted

java.lang.NoClassDefFoundError: org/bouncycastle/jcajce/provider/digest/Keccak$DigestKeccak

when using:

<dependency>
<groupId>org.web3j</groupId>
<artifactId>web3j-spring-boot-starter</artifactId>
<version>1.6.0</version>
</dependency>

calling :

Credentials credentials = WalletUtils.loadCredentials(

but it throws:

20870: ERROR [dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/bouncycastle/jcajce/provider/digest/Keccak$DigestKeccak] with root cause
java.lang.ClassNotFoundException: org.bouncycastle.jcajce.provider.digest.Keccak$DigestKeccak
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:178)
	at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.web3j.crypto.Wallet.generateMac(Wallet.java:173)
	at org.web3j.crypto.Wallet.decrypt(Wallet.java:211)
	at org.web3j.crypto.WalletUtils.loadCredentials(WalletUtils.java:113)
	at org.web3j.crypto.WalletUtils.loadCredentials(WalletUtils.java:107)
···

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.