Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: javax/mail/MessagingException unsolved

I'm trying to add the javax.mail jar to my classpath but I get this error:

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.

I've readed in other post that it could be fixed adding the dependecy to the pom.xml, so I did it:

pom.xml

<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.4.3</version>
</dependency>

project

But still I'm getting the error ..can someone help me with this?

like image 348
Rafael Reyes Avatar asked Feb 02 '15 20:02

Rafael Reyes


2 Answers

Also with the 1.4.3 version there is no longer an artifact id called mail. If you want to use 1.4.3 you should use this dependency

<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mailapi</artifactId>
    <version>1.4.3</version>
</dependency>
like image 198
vanval Avatar answered Oct 17 '22 04:10

vanval


You should add the jar to the server Tomcat.

  1. Open launch configuration

    You should open launch configuration

  2. Add external jar (look for your email jar)

    Add external jar and look for your email jar

like image 44
Ayad Avatar answered Oct 17 '22 02:10

Ayad