【问题标题】:Strange Exception while working with EWS使用 EWS 时出现奇怪的异常
【发布时间】:2020-01-09 18:56:07
【问题描述】:

我正在创建一个项目以从 Exchange 服务器获取电子邮件。我正在接受 EWS 的帮助来完成这项工作。

我已将以下依赖项添加到我的 pom.xml 中

<dependencies>    
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.10</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.microsoft.ews-java-api</groupId>
            <artifactId>ews-java-api</artifactId>
            <version>2.0</version>
        </dependency>
</dependencies>

在我的代码中,我收到以下 import 错误。

导入 microsoft.exchange.webservices.data.core.ExchangeService 无法解决

导入 microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion 无法解决

另外,我的包裹出现错误,内容如下。

类型 microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion 无法解决。它是从必需的 .class 中间接引用的 文件

当我打开我的礼仪树时,我很惊讶地看到core.ExchangeService 可用(请看下面的截图)。但是core.enumeration.misc.ExchangeVersion 不见了。

请告诉我如何解决这些问题。

谢谢

【问题讨论】:

    标签: java exchangewebservices


    【解决方案1】:

    这似乎是一个 Eclipse 错误,尽管重新启动 Eclipse 对我来说效果很好,希望这对其他人也有帮助。 请参阅 [http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html][1] 了解可能的解决方案,否则请尝试以下操作;

    Close the project and reopen it.
    Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries)
    

    Delete and Re-import the project and if necessary do the above steps again.
    

    如果有任何问题,请尝试使用其他 IDE,它可能会起作用。

    【讨论】:

    • 感谢这位快速提示的朋友,我已经尝试了所有方法,当我没有找到任何解决方案时在这里发布。
    • 我想你也尝试过 maven clean 如果没有,那么也试试这个。如果你有 Eclipse 以外的任何其他 IDE,请尝试一次。
    【解决方案2】:

    当 Eclipse 无法正确导入 jar 时,会出现此错误。除了上面Maheshwar Ligade 提到的修复,您还可以尝试从代码中删除导入语句,保存它,重新添加导入代码,然后再次保存。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多