gpt4 book ai didi

java - 文件夹绑定(bind) MsExchange 失败

转载 作者:太空宇宙 更新时间:2023-11-04 10:43:42 25 4
gpt4 key购买 nike

以下代码从最后一行开始出现错误。怎么了?我该如何修复它?

我的代码:

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)

最佳答案

由于不熟悉 Java 环境中的 EWS,我只能提供猜测。该异常提示证书路径,因此我认为您的应用程序由于证书信任问题而无法获得与 Exchange 的 TLS 连接。您可以在运行程序的同一机器上通过 HTTPS 浏览到 OWA 吗?

关于java - 文件夹绑定(bind) MsExchange 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48658371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com