DavX⁵ / Davdroid: 'Couldn't find CalDAV or CardDAV service' when setting up new accounts

I have some accounts synced via CalDAV with Davdroid, now called DavX⁵. These accounts work fine.

However, when i want to connect a new account with DavX⁵ shows the error message:

Couldn't find CalDAV or CardDAV service

And the following log:

--- BEGIN DEBUG INFO ---

LOGS:
2019-01-28 14:42:51 8131 [ui.setup.DavResourceFinder] Finding initial carddav service configuration
2019-01-28 14:42:51 8131 [ui.setup.DavResourceFinder] Checking user-given URL: https://example.com/remote.php/dav
2019-01-28 14:42:51 8131 [HttpClient] --> PROPFIND https://example.com/remote.php/dav
2019-01-28 14:42:51 8131 [HttpClient] Content-Type: application/xml; charset=utf-8
2019-01-28 14:42:51 8131 [HttpClient] Content-Length: 290
2019-01-28 14:42:51 8131 [HttpClient] Depth: 0
2019-01-28 14:42:51 8131 [HttpClient] 
2019-01-28 14:42:51 8131 [HttpClient] <?xml version='1.0' encoding='UTF-8' ?><propfind xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav"><prop><resourcetype /><displayname /><CARD:addressbook-description /><CARD:addressbook-home-set /><current-user-principal /></prop></propfind>
2019-01-28 14:42:51 8131 [HttpClient] --> END PROPFIND (290-byte body)
2019-01-28 14:42:52 8131 [HttpClient] <-- HTTP FAILED: java.net.ConnectException: Failed to connect to example.com/12.34.56.78:443
2019-01-28 14:42:52 8131 [ui.setup.DavResourceFinder] PROPFIND/OPTIONS on user-given URL failed
EXCEPTION java.net.ConnectException: Failed to connect to example.com/12.34.56.78:443
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:248)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:166)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:225)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
	at okhttp3.RealCall.execute(RealCall.java:92)
	at at.bitfire.dav4jvm.DavResource$propfind$1.invoke(DavResource.kt:323)
	at at.bitfire.dav4jvm.DavResource$propfind$1.invoke(DavResource.kt:34)
	at at.bitfire.dav4jvm.DavResource.followRedirects(DavResource.kt:378)
	at at.bitfire.dav4jvm.DavResource.propfind(DavResource.kt:318)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.checkUserGivenURL(DavResourceFinder.kt:187)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.findInitialConfiguration(DavResourceFinder.kt:122)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.findInitialConfiguration(DavResourceFinder.kt:79)
	at at.bitfire.davdroid.ui.setup.DetectConfigurationFragment$ServerConfigurationLoader.loadInBackground(DetectConfigurationFragment.kt:136)
	at at.bitfire.davdroid.ui.setup.DetectConfigurationFragment$ServerConfigurationLoader.loadInBackground(DetectConfigurationFragment.kt:120)
	at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
	at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
	at java.lang.Thread.run(Thread.java:761)
Caused by: java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:334)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:196)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
	at java.net.Socket.connect(Socket.java:605)
	at okhttp3.internal.platform.AndroidPlatform.connectSocket(AndroidPlatform.java:73)
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:246)
	... 37 more

2019-01-28 14:42:52 8131 [HttpClient] --> PROPFIND https://example.com/.well-known/carddav
2019-01-28 14:42:52 8131 [HttpClient] Content-Type: application/xml; charset=utf-8
2019-01-28 14:42:52 8131 [HttpClient] Content-Length: 198
2019-01-28 14:42:52 8131 [HttpClient] Depth: 0
2019-01-28 14:42:52 8131 [HttpClient] 
2019-01-28 14:42:52 8131 [HttpClient] <?xml version='1.0' encoding='UTF-8' ?><propfind xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav"><prop><current-user-principal /></prop></propfind>
2019-01-28 14:42:52 8131 [HttpClient] --> END PROPFIND (198-byte body)
2019-01-28 14:42:53 8131 [HttpClient] <-- HTTP FAILED: java.net.ConnectException: Failed to connect to example.com/12.34.56.78:443
2019-01-28 14:42:53 8131 [ui.setup.DavResourceFinder] Well-known URL detection failed
EXCEPTION java.net.ConnectException: Failed to connect to example.com/12.34.56.78:443
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:248)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:166)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:225)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
	at okhttp3.RealCall.execute(RealCall.java:92)
	at at.bitfire.dav4jvm.DavResource$propfind$1.invoke(DavResource.kt:323)
	at at.bitfire.dav4jvm.DavResource$propfind$1.invoke(DavResource.kt:34)
	at at.bitfire.dav4jvm.DavResource.followRedirects(DavResource.kt:378)
	at at.bitfire.dav4jvm.DavResource.propfind(DavResource.kt:318)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.getCurrentUserPrincipal(DavResourceFinder.kt:392)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.findInitialConfiguration(DavResourceFinder.kt:126)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.findInitialConfiguration(DavResourceFinder.kt:79)
	at at.bitfire.davdroid.ui.setup.DetectConfigurationFragment$ServerConfigurationLoader.loadInBackground(DetectConfigurationFragment.kt:136)
	at at.bitfire.davdroid.ui.setup.DetectConfigurationFragment$ServerConfigurationLoader.loadInBackground(DetectConfigurationFragment.kt:120)
	at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
	at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
	at java.lang.Thread.run(Thread.java:761)
Caused by: java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:334)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:196)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
	at java.net.Socket.connect(Socket.java:605)
	at okhttp3.internal.platform.AndroidPlatform.connectSocket(AndroidPlatform.java:73)

example.com and 12.34.56.78 are placeholders for the reals domain/ip.

I can reproduce this with all Nextcloud instances i have access to and it is not depending on the url (i tried with and without remote.php/dav [and varying trailing slashes…]).

I had the same, after deleting DAV… App and restart the Phone and reinstall DAVx I have no more problems to connect any DAV Account

Unfortunately it didn’t change anything.

I believe it is a server issue as it is device independent and happens with different NC Versions (14 and 13) run by different people on different web servers (Apache and NginX).

I posted it to the DavX⁵ Forum, maybe they have an idea:

One step further, after some log investigations:

@moonlies said in ‘Couldn’t find CalDAV or CardDAV service’ when setting up new accounts, while synchronisation works fine:

@rfc2822
Yes, i found something, however it doesn’t make it any less weird:

My account is syncing properly, i can see it in DavX⁵ and i see it in the access logs of nginx (answer code 207). Now, if i want to add the same account again, the requests are all answered with an error 401 at the same time the error shows in DavX⁵.

For the other account i added, the access is immediately denied for all requests.

This totally looks like a wrong credentials issue, however, as i mentioned, my own account works just fine, as long as i do not want to add it again. I am clueless. :thinking_face:

I had an issue with this when I enabled 2FA on Nextcloud, DavX5 didn’t like that. Worked again as soon as I disabled it.

That’s exactly the reason why app specific passwords exist under Settings > Personal > Security :wink:

I ALWAYS forget about that. Always. Thanks you.

1 Like

I did to sposborne, thank you for sharing this with us. ELR-2023