java.lang.NoClassDefFoundError:javax/mail/MessagingException未解决

Raf*_*yes 7 java javax.mail maven

我正在尝试将javax.mail jar添加到我的类路径中,但是我收到此错误:

java.lang.NoClassDefFoundError: javax/mail/MessagingException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2663)
    at java.lang.Class.getDeclaredConstructors(Class.java:2012)
    at org.springframework.beans.factory.annotation.
Run Code Online (Sandbox Code Playgroud)

我在其他帖子中已经知道可以修复将依赖性添加到pom.xml中,所以我做到了:

的pom.xml

<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.4.3</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

项目

但我仍然得到错误..有人帮我这个吗?

van*_*val 8

同样在1.4.3版本中,不再有称为mail的工件ID.如果要使用1.4.3,则应使用此依赖关系

<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mailapi</artifactId>
    <version>1.4.3</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)