Web3j: Invalid response received: okhttp3.internal.http.RealResponseBody@41f30eb2

Created on 5 Mar 2018  路  2Comments  路  Source: web3j/web3j

Hi,
I used the following code and run it in a separate java thread, then connect to mainnet.infura.io/my_token, but I got Invalid response received exception, also from the httpService log, it shows 405 Method Not Allowed, any clue?

Thanks

CountDownLatch countDownLatch = new CountDownLatch(EVENT_COUNT);
CountDownLatch completedLatch = new CountDownLatch(EVENT_COUNT);

    Subscription subscription = observable.subscribe(
                x -> {
                    countDownLatch.countDown();
                    logger.debug("Monitoring enter run. observable x: " + x);
                },
                e -> {
                    logger.error("exception occurred in subscription tx", e);
                },
                () -> {
                    completedLatch.countDown();
                }

    );

Most helpful comment

These methods use filters behind the scenes that are not supported by Infura. Please refer to the docs for more info.

All 2 comments

I also tried with ropsten.infura.io, but still the same exception, also tried this code and get the same error:

Subscription subscription = web3j.blockObservable(false).subscribe(block -> {
System.out.println("Sweet, block number " + block.getBlock().getNumber() + " has just been created");
}, Throwable::printStackTrace);

        TimeUnit.MINUTES.sleep(2);
        subscription.unsubscribe();

My web3Client version return is Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.2.
I am using web3j 3.3.1.
Thanks

These methods use filters behind the scenes that are not supported by Infura. Please refer to the docs for more info.

Was this page helpful?
0 / 5 - 0 ratings