OfficeDev / ews-java-api

A java client library to access Exchange web services. The API works against Office 365 Exchange Online as well as on premises Exchange.
MIT License
868 stars 559 forks source link

I/O exception (java.net.SocketException): Network is unreachable #569

Open marbetschar opened 8 years ago

marbetschar commented 8 years ago

For some reason I receive the above error on the production machine (Linux). Strange thing is, on my dev machine - which is a windows system - there is no such error while using the exact same connection information.

Even more odd after several retries it just starts working, till the next time this code should be executed a few minutes later; then it needs again several retries to run properly.

Please note the code runs as a daemon within an endless loop, which sleeps several minutes between the different executions.

Oct 18, 2016 3:22:46 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://autodiscover.domain.tld:443: Network is unreachable
Oct 18, 2016 3:22:46 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://autodiscover.domain.tld:443
Oct 18, 2016 3:22:47 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://autodiscover.domain.tld:443: Network is unreachable
Oct 18, 2016 3:22:47 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://autodiscover.domain.tld:443
Oct 18, 2016 3:22:47 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://autodiscover.domain.tld:443: Network is unreachable
Oct 18, 2016 3:22:47 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://autodiscover.domain.tld:443
Oct 18, 2016 3:22:49 PM tld.domain.sync.Sync executeForNewerThan
INFO: LOAD | CUSTOM#552
Oct 18, 2016 3:22:49 PM tld.domain.sync.Sync executeForNewerThan
INFO: LOAD | EWS#user@domain.tld
Oct 18, 2016 3:23:35 PM tld.domain.sync.Sync executeForNewerThan
marbetschar commented 8 years ago

Ok; it seems to be a regular networking issue. If I try to telnet autodiscover.domain.tld 443 I got the following errors on the Linux server:

$: telnet autodiscover.domain.tld 443
Trying autodiscover.domain.tld...
...
telnet: Unable to connect to remote host: Network is unreachable

I've also tried it on my Windows box; quite the same result. NO connection can be established with telnet. Now I'm curious: Why the hell does it work in Java on Windows without any error and on Linux at least after several tries? In my opinion it should either be a permanent failure or a permanent success ...?! Does the EWS Java API switch to port 80 every once in a while?!

PranamBhat commented 5 years ago

Whenever I run my application, I'm getting the connection request failure exception. The application tries to hit the URL and end up with connection failure.

I have tried the same on Postman. It is giving me 200: OK.

I have the proxy and port as well. How to use it in our spring boot application. Whenever the application runs it should take the respective proxy and port.

I'm attaching here the logs:

creating event for user 0852 for campaign source TEST at stage INITIAL_LANDING creating event for user 0852 for campaign source TEST at stage CLICK_DEMO 2019-07-19 15:15:39.680 INFO 49560 --- [nio-9898-exec-8] o.a.http.impl.client.DefaultHttpClient : I/O exception (java.net.SocketException) caught when connecting to {s}->https://pi-collector-dev.tr-corporate-nonprod.aws-int.thomsonreuters.com:443: Connection reset 2019-07-19 15:15:39.683 INFO 49560 --- [nio-9898-exec-8] o.a.http.impl.client.DefaultHttpClient : Retrying connect to {s}->https://pi-collector-dev.tr-corporate-nonprod.aws-int.thomsonreuters.com:443 2019-07-19 15:15:49.302 INFO 49560 --- [nio-9898-exec-8] o.a.http.impl.client.DefaultHttpClient : I/O exception (java.net.SocketException) caught when connecting to {s}->https://pi-collector-dev.tr-corporate-nonprod.aws-int.thomsonreuters.com:443: Connection reset 2019-07-19 15:15:49.304 INFO 49560 --- [nio-9898-exec-8] o.a.http.impl.client.DefaultHttpClient : Retrying connect to {s}->https://pi-collector-dev.tr-corporate-nonprod.aws-int.thomsonreuters.com:443 2019-07-19 15:15:58.904 INFO 49560 --- [nio-9898-exec-8] o.a.http.impl.client.DefaultHttpClient : I/O exception (java.net.SocketException) caught when connecting to {s}->https://pi-collector-dev.tr-corporate-nonprod.aws-int.thomsonreuters.com:443: Connection reset 2019-07-19 15:15:58.906 INFO 49560 --- [nio-9898-exec-8] o.a.http.impl.client.DefaultHttpClient : Retrying connect to {s}->https://pi-collector-dev.tr-corporate-nonprod.aws-int.thomsonreuters.com:443 2019-07-19 15:16:08.665 ERROR 49560 --- [nio-9898-exec-8] c.t.providers.persistent.InMemoryQueue : Failed to push events to destination.

nadavye commented 4 years ago

Guys, Did you manage to solve/debug it? I'm having a similar issue.

marbetschar commented 4 years ago

@nadavye unfortunately no, still the same issue from time to time - no clue why. Any info on your end?

aahtesham commented 3 years ago

Guys anyone Solve this one??