SSLHandshake Exception and provider XMLOutputFactoryBase not found in Microsoft Exchange

%3CLINGO-SUB%20id%3D%22lingo-sub-1335222%22%20slang%3D%22en-US%22%3ESSLHandshake%20Exception%20and%20provider%20XMLOutputFactoryBase%20not%20found%20in%20Microsoft%20Exchange%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1335222%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20been%20using%20Microsoft%20EWS%20in%20my%20Android%20application.%20The%20Android%20devices%20with%20versions%20%26lt%3B%204.4%20received%20%60Javax.net.ssl.SSLHandshakeException%60%2C%20so%20I%20had%20to%20add%20the%20code%20below%20to%20solve%20the%20issue%20from%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fstackoverflow.com%2Fquestions%2F29916962%2Fjavax-net-ssl-sslhandshakeexception-javax-net-ssl-sslprotocolexception-ssl-han%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Elink%3C%2FA%3E%26nbsp%3B.%20I%20tried%20other%20solutions%20related%20to%20these%20issues%2C%20but%20none%20other%20than%20these%20lines%20of%20codes%20worked.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EProviderInstaller.installIfNeeded(getApplicationContext())%3B%3CBR%20%2F%3ESSLContext%20sslContext%3B%3CBR%20%2F%3EsslContext%20%3D%20SSLContext.getInstance(%22TLSv1.1%22)%3B%3CBR%20%2F%3EsslContext.init(null%2C%20null%2C%20null)%3B%3CBR%20%2F%3EsslContext.createSSLEngine()%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EAfter%20adding%20the%20code%2C%20the%20SSL%20issue%20was%20solved%2C%20but%20then%20came%20yet%20another%20big%20issue%2C%20the%20Microsoft%20EWS%20functions%20(login%2C%20create%20the%20event%2C%20etc..)%20keep%20crashing%3A%3C%2FP%3E%3CP%3ECaused%20by%3A%20android.javax.xml.stream.FactoryConfigurationError%3A%20Provider%20com.bea.xml.stream.XMLOutputFactoryBase%20not%20found%3CBR%20%2F%3Eat%20android.javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java%3A72)%3CBR%20%2F%3Eat%20android.javax.xml.stream.FactoryFinder.find(FactoryFinder.java%3A176)%3CBR%20%2F%3Eat%20android.javax.xml.stream.FactoryFinder.find(FactoryFinder.java%3A92)%3CBR%20%2F%3Eat%20android.javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java%3A98)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.EwsServiceXmlWriter.(EwsServiceXmlWriter.java%3A101)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.request.ServiceRequestBase.buildEwsHttpWebRequest(ServiceRequestBase.java%3A692)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.request.ServiceRequestBase.buildEwsHttpPoolingWebRequest(ServiceRequestBase.java%3A682)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.request.ServiceRequestBase.validateAndEmitRequest(ServiceRequestBase.java%3A639)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java%3A62)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java%3A158)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.ExchangeService.bindToFolder(ExchangeService.java%3A505)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.ExchangeService.bindToFolder(ExchangeService.java%3A523)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.service.folder.CalendarFolder.bind(CalendarFolder.java%3A60)%3CBR%20%2F%3Eat%20microsoft.exchange.webservices.data.core.service.folder.CalendarFolder.bind(CalendarFolder.java%3A75)%3CBR%20%2F%3Eat%20com.billinar.bookit.helpers.exchange.ExchangeHelper.login(ExchangeHelper.java%3A183)%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EPlease%20help%20me%20with%20this%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1335222%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Frequent Visitor

I have been using Microsoft EWS in my Android application. The Android devices with versions < 4.4 received `Javax.net.ssl.SSLHandshakeException`, so I had to add the code below to solve the issue from this link . I tried other solutions related to these issues, but none other than these lines of codes worked.


ProviderInstaller.installIfNeeded(getApplicationContext());
SSLContext sslContext;
sslContext = SSLContext.getInstance("TLSv1.1");
sslContext.init(null, null, null);
sslContext.createSSLEngine();


After adding the code, the SSL issue was solved, but then came yet another big issue, the Microsoft EWS functions (login, create the event, etc..) keep crashing:

Caused by: android.javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.XMLOutputFactoryBase not found
at android.javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
at android.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:176)
at android.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
at android.javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java:98)
at microsoft.exchange.webservices.data.core.EwsServiceXmlWriter.(EwsServiceXmlWriter.java:101)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.buildEwsHttpWebRequest(ServiceRequestBase.java:692)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.buildEwsHttpPoolingWebRequest(ServiceRequestBase.java:682)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.validateAndEmitRequest(ServiceRequestBase.java:639)
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:62)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
at microsoft.exchange.webservices.data.core.ExchangeService.bindToFolder(ExchangeService.java:505)
at microsoft.exchange.webservices.data.core.ExchangeService.bindToFolder(ExchangeService.java:523)
at microsoft.exchange.webservices.data.core.service.folder.CalendarFolder.bind(CalendarFolder.java:60)
at microsoft.exchange.webservices.data.core.service.folder.CalendarFolder.bind(CalendarFolder.java:75)
at com.billinar.bookit.helpers.exchange.ExchangeHelper.login(ExchangeHelper.java:183)


Please help me with this issue.

0 Replies