以下代码从最后一行给出错误。怎么了?我该如何解决?
我的代码:
service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.setUrl(new URI(getDomain()));
ExchangeCredentials credentials = new WebCredentials(emailUsername, emailPassword, getDefaultCredentials());
service.setCredentials(credentials);
System.out.println("Authorize Ms exchange OK");
Folder folder = null;
folder = Folder.bind(service, WellKnownFolderName.Inbox);
分隔日志:
microsoft.exchange.webservices.data.ServiceRequestException: The request failed. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
microsoft.exchange.webservices.data.ServiceRequestBase.getEwsHttpWebResponse(Unknown Source)
microsoft.exchange.webservices.data.ServiceRequestBase.validateAndEmitRequest(Unknown Source)
microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source)
microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source)
microsoft.exchange.webservices.data.ExchangeService.bindToFolder(Unknown Source)
microsoft.exchange.webservices.data.ExchangeService.bindToFolder(Unknown Source)
microsoft.exchange.webservices.data.Folder.bind(Unknown Source)
microsoft.exchange.webservices.data.Folder.bind(Unknown Source)
com.prudential.pru.process.MsExchangeProcessor.getEmailRequest(MsExchangeProcessor.java:671)
com.prudential.pru.process.MsExchangeProcess.retrieveEmailIsNotRead(MsExchangeProcess.java:70)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
答案 0 :(得分:0)
在Java环境中不熟悉EWS,我所能提供的就是猜测。该例外有关于证书路径的抱怨,因此我说由于证书信任问题,您的应用无法与Exchange建立TLS连接。您可以在运行程序的同一个框上HTTPS浏览到OWA吗?