java.lang.NoClassDefFoundError: com/sun/mail/util/MessageRemovedIOException

java.lang.NoClassDefFoundError: com/sun/mail/util/MessageRemovedIOException

Hi,

In my maven project its giving following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/MessageRemovedIOException
    at example.MailWithPasswordAuthentication.run(MailWithPasswordAuthentication.java:19)
    at example.MailWithPasswordAuthentication.main(MailWithPasswordAuthentication.java:15)
Caused by: java.lang.ClassNotFoundException: com.sun.mail.util.MessageRemovedIOException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 2 more

How to solve this issue?

Thanks

View Answers

August 3, 2017 at 8:21 AM

Hi,

Add following dependency in pom.xml:

<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>javax.mail-api</artifactId>
    <version>1.5.5</version>
</dependency>
<dependency>
    <groupId>com.sun.mail</groupId>
    <artifactId>javax.mail</artifactId>
    <version>1.5.5</version>
</dependency>

Thanks









Related Tutorials/Questions & Answers:

Ads