#566 Using Exchange Protocol "Auto" on Exchange 2013 leads to several NullPointerExcheptions

v4.4.1
closed
5
2015-02-25
2014-04-30
Sven Eden
No

To connect to our Exchange 2013 Server I have to set davmail to use EWS only. Unfortunately certain calendars can not be accessed as their parent folder has the permission "AvailabilityOnly" which leads to EWS failing with a FolderNotFound reply. (In owa and Outlook it just works.)

However, when I switch Exchange Protocol to "Auto", davmail fails with multiple null pointer exceptions: (Log trimmed and user/server data changed.)

2014-04-30 08:57:06,052 DEBUG [LdapConnection-46629] davmail  - Found permanently accepted certificate, hash 7D:FA:AC:24:F8:BB:97:AC:ED:B:50:CF:90:3C:8C:D8:83:72:EF:16
2014-04-30 08:57:06,052 DEBUG [CaldavConnection-50199] davmail  - Found permanently accepted certificate, hash 7D:FA:AC:24:F8:BB:97:AC:ED:B:50:CF:90:3C:8C:D8:83:72:EF:16
2014-04-30 08:57:06,083 DEBUG [LdapConnection-46629] davmail.exchange.ExchangeSession  - Test configuration status: 302
2014-04-30 08:57:06,085 DEBUG [LdapConnection-46629] davmail  - LDAP_REQ_BIND 1 USER@COMPANY.DOMAIN
2014-04-30 08:57:06,095 DEBUG [CaldavConnection-50199] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa)
2014-04-30 08:57:06,101 DEBUG [CaldavConnection-50199] davmail  - executeFollowRedirects: https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa&reason=0 redirectCount:1
2014-04-30 08:57:06,107 DEBUG [CaldavConnection-50199] davmail.exchange.ExchangeSession  - Form based authentication detected
2014-04-30 08:57:06,146 DEBUG [CaldavConnection-50199] davmail.exchange.ExchangeSession  - Detected script based logon, redirect to form at https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa
2014-04-30 08:57:06,147 DEBUG [CaldavConnection-50199] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa)
2014-04-30 08:57:06,204 DEBUG [CaldavConnection-50199] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa/auth.owa)
2014-04-30 08:57:06,214 DEBUG [CaldavConnection-50199] davmail  - executeFollowRedirects: https://SERVER.COMPANY.DOMAIN/owa redirectCount:1
2014-04-30 08:57:06,251 DEBUG [CaldavConnection-50199] davmail  - executeFollowRedirects: /owa/ redirectCount:2
2014-04-30 08:57:06,500 WARN  [CaldavConnection-50199] davmail.http.DavGatewayHttpClientFacade  - GET failed with status 404 at https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER
2014-04-30 08:57:06,500 DEBUG [CaldavConnection-50199] davmail.exchange.ExchangeSession  - GET https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER failed: davmail.exception.HttpNotFoundException: 404 Not Found at https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER 404 Not Found at https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER
2014-04-30 08:57:06,500 DEBUG [CaldavConnection-50199] davmail.exchange.ExchangeSession  - getEmail(USER) failed
2014-04-30 08:57:06,500 DEBUG [CaldavConnection-50199] davmail.exchange.ExchangeSession  - Unable to get user email with alias null or USER or null
2014-04-30 08:57:06,501 ERROR [CaldavConnection-50199] davmail  - java.lang.NullPointerException
java.lang.NullPointerException
    at davmail.exchange.dav.DavExchangeSession.buildEmail(DavExchangeSession.java:643)
    at davmail.exchange.dav.DavExchangeSession.buildMailPath(DavExchangeSession.java:582)
    at davmail.exchange.dav.DavExchangeSession.buildSessionInfo(DavExchangeSession.java:505)
    at davmail.exchange.ExchangeSession.<init>(ExchangeSession.java:235)
    at davmail.exchange.dav.DavExchangeSession.<init>(DavExchangeSession.java:500)
    at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:146)
    at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:94)
    at davmail.caldav.CaldavConnection.run(CaldavConnection.java:167)
2014-04-30 08:57:06,514 DEBUG [LdapConnection-46629] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa)
2014-04-30 08:57:06,518 DEBUG [LdapConnection-46629] davmail  - executeFollowRedirects: https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa&reason=0 redirectCount:1
2014-04-30 08:57:06,522 DEBUG [LdapConnection-46629] davmail.exchange.ExchangeSession  - Form based authentication detected
2014-04-30 08:57:06,528 DEBUG [LdapConnection-46629] davmail.exchange.ExchangeSession  - Detected script based logon, redirect to form at https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa
2014-04-30 08:57:06,528 DEBUG [LdapConnection-46629] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa)
2014-04-30 08:57:06,541 DEBUG [LdapConnection-46629] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa/auth.owa)
2014-04-30 08:57:06,551 DEBUG [LdapConnection-46629] davmail  - executeFollowRedirects: https://SERVER.COMPANY.DOMAIN/owa redirectCount:1
2014-04-30 08:57:06,589 DEBUG [LdapConnection-46629] davmail  - executeFollowRedirects: /owa/ redirectCount:2
2014-04-30 08:57:06,666 DEBUG [LdapConnection-46629] davmail.exchange.ExchangeSession  - Unable to get user email with alias null or null or null
2014-04-30 08:57:06,666 ERROR [LdapConnection-46629] davmail  - java.lang.NullPointerException
java.lang.NullPointerException
    at davmail.exchange.dav.DavExchangeSession.buildEmail(DavExchangeSession.java:641)
    at davmail.exchange.dav.DavExchangeSession.buildMailPath(DavExchangeSession.java:582)
    at davmail.exchange.dav.DavExchangeSession.buildSessionInfo(DavExchangeSession.java:505)
    at davmail.exchange.ExchangeSession.<init>(ExchangeSession.java:235)
    at davmail.exchange.dav.DavExchangeSession.<init>(DavExchangeSession.java:500)
    at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:146)
    at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:94)
    at davmail.ldap.LdapConnection.handleRequest(LdapConnection.java:604)
    at davmail.ldap.LdapConnection.run(LdapConnection.java:489)
2014-04-30 08:57:06,681 DEBUG [CaldavConnection-50202] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa)
2014-04-30 08:57:06,685 DEBUG [CaldavConnection-50202] davmail  - executeFollowRedirects: https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa&reason=0 redirectCount:1
2014-04-30 08:57:06,689 DEBUG [CaldavConnection-50202] davmail.exchange.ExchangeSession  - Form based authentication detected
2014-04-30 08:57:06,691 DEBUG [CaldavConnection-50202] davmail.exchange.ExchangeSession  - Detected script based logon, redirect to form at https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa
2014-04-30 08:57:06,692 DEBUG [CaldavConnection-50202] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fSERVER.COMPANY.DOMAIN%2fowa)
2014-04-30 08:57:06,704 DEBUG [CaldavConnection-50202] davmail  - executeFollowRedirects(https://SERVER.COMPANY.DOMAIN/owa/auth.owa)
2014-04-30 08:57:06,750 DEBUG [CaldavConnection-50202] davmail  - executeFollowRedirects: https://SERVER.COMPANY.DOMAIN/owa redirectCount:1
2014-04-30 08:57:06,783 DEBUG [CaldavConnection-50202] davmail  - executeFollowRedirects: /owa/ redirectCount:2
2014-04-30 08:57:06,865 WARN  [CaldavConnection-50202] davmail.http.DavGatewayHttpClientFacade  - GET failed with status 404 at https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER
2014-04-30 08:57:06,865 DEBUG [CaldavConnection-50202] davmail.exchange.ExchangeSession  - GET https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER failed: davmail.exception.HttpNotFoundException: 404 Not Found at https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER 404 Not Found at https://SERVER.COMPANY.DOMAIN/public/?Cmd=galfind&AN=USER
2014-04-30 08:57:06,865 DEBUG [CaldavConnection-50202] davmail.exchange.ExchangeSession  - getEmail(USER) failed
2014-04-30 08:57:06,866 DEBUG [CaldavConnection-50202] davmail.exchange.ExchangeSession  - Unable to get user email with alias null or USER or null
2014-04-30 08:57:06,866 ERROR [CaldavConnection-50202] davmail  - java.lang.NullPointerException
java.lang.NullPointerException
    at davmail.exchange.dav.DavExchangeSession.buildEmail(DavExchangeSession.java:643)
    at davmail.exchange.dav.DavExchangeSession.buildMailPath(DavExchangeSession.java:582)
    at davmail.exchange.dav.DavExchangeSession.buildSessionInfo(DavExchangeSession.java:505)
    at davmail.exchange.ExchangeSession.<init>(ExchangeSession.java:235)
    at davmail.exchange.dav.DavExchangeSession.<init>(DavExchangeSession.java:500)
    at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:146)
    at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:94)
    at davmail.caldav.CaldavConnection.run(CaldavConnection.java:167)
2014-04-30 08:57:07,503 DEBUG [CaldavConnection-50199] davmail  - > HTTP/1.1 503 Service Unavailable
2014-04-30 08:57:07,503 DEBUG [CaldavConnection-50199] davmail  - > Server: DavMail Gateway 4.4.1-2225
2014-04-30 08:57:07,503 DEBUG [CaldavConnection-50199] davmail  - > DAV: 1, calendar-access, calendar-schedule, calendarserver-private-events, addressbook
2014-04-30 08:57:07,504 DEBUG [CaldavConnection-50199] davmail  - > Date: Wed, 30 Apr 2014 06:57:07 +0000
2014-04-30 08:57:07,504 DEBUG [CaldavConnection-50199] davmail  - > Expires: Wed, 30 Apr 2014 06:57:07 +0000
2014-04-30 08:57:07,504 DEBUG [CaldavConnection-50199] davmail  - > Cache-Control: private, max-age=0
2014-04-30 08:57:07,504 DEBUG [CaldavConnection-50199] davmail  - > Content-Type: text/plain;charset=UTF-8
2014-04-30 08:57:07,504 DEBUG [CaldavConnection-50199] davmail  - > Connection: close
2014-04-30 08:57:07,505 DEBUG [CaldavConnection-50199] davmail  - > Content-Length: 30
2014-04-30 08:57:07,505 DEBUG [CaldavConnection-50199] davmail  - > 
2014-04-30 08:57:07,505 DEBUG [CaldavConnection-50199] davmail.caldav.CaldavConnection  - > java.lang.NullPointerException
2014-04-30 08:57:07,866 DEBUG [CaldavConnection-50202] davmail  - > HTTP/1.1 503 Service Unavailable
2014-04-30 08:57:07,866 DEBUG [CaldavConnection-50202] davmail  - > Server: DavMail Gateway 4.4.1-2225
2014-04-30 08:57:07,867 DEBUG [CaldavConnection-50202] davmail  - > DAV: 1, calendar-access, calendar-schedule, calendarserver-private-events, addressbook
2014-04-30 08:57:07,867 DEBUG [CaldavConnection-50202] davmail  - > Date: Wed, 30 Apr 2014 06:57:07 +0000
2014-04-30 08:57:07,867 DEBUG [CaldavConnection-50202] davmail  - > Expires: Wed, 30 Apr 2014 06:57:07 +0000
2014-04-30 08:57:07,867 DEBUG [CaldavConnection-50202] davmail  - > Cache-Control: private, max-age=0
2014-04-30 08:57:07,867 DEBUG [CaldavConnection-50202] davmail  - > Content-Type: text/plain;charset=UTF-8
2014-04-30 08:57:07,867 DEBUG [CaldavConnection-50202] davmail  - > Connection: close
2014-04-30 08:57:07,868 DEBUG [CaldavConnection-50202] davmail  - > Content-Length: 30
2014-04-30 08:57:07,868 DEBUG [CaldavConnection-50202] davmail  - > 
2014-04-30 08:57:07,868 DEBUG [CaldavConnection-50202] davmail.caldav.CaldavConnection  - > java.lang.NullPointerException

Discussion

  • With Exchange 2013 you should use EWS mode and /ews/exchange.asmx path for direct EWS access

     
    • status: open --> closed