Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

class file for javax.mail.internet.MimeMessage not found

I am getting following error while building my project.

City\controller\MyMailHelper.java:59: cannot access javax.mail.internet.MimeMessage
class file for javax.mail.internet.MimeMessage not found

In application code I am referring following imports.

import org.springframework.mail.javamail.MimeMailMessage;
import org.springframework.mail.javamail.MimeMessageHelper;

Spring dependency taken from the maven dependency tree of my project is given below . Could someone help me to identify which dependency is making this problem.

Line 27:  |  +- org.springframework:spring-jdbc:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
    Line 28:  |  +- org.springframework:spring-orm:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
    Line 29:  |  +- org.springframework:spring-jms:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
    Line 52:  |  +- org.springframework:spring-beans:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile
    Line 53:  |  +- org.springframework:spring-aop:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
    Line 64:  +- org.springframework:spring-core:jar:3.2.1.RELEASE:compile
    Line 65:  +- org.springframework:spring-context:jar:3.2.1.RELEASE:compile
    Line 66:  |  \- org.springframework:spring-expression:jar:3.2.1.RELEASE:compile
    Line 67:  +- org.springframework:spring-web:jar:3.2.1.RELEASE:compile
    Line 69:  +- org.springframework:spring-webmvc:jar:3.2.1.RELEASE:compile
    Line 74:  |  +- org.springframework.ws:spring-ws:jar:all:2.0.5.RELEASE:compile
    Line 77:  |  +- org.springframework:spring-tx:jar:3.1.3.RELEASE:compile
    Line 90:  |  +- org.springframework.ws:spring-ws-core:jar:2.1.2.RELEASE:compile (version managed from 2.1.2.RELEASE)
    Line 91:  |  |  +- org.springframework.ws:spring-xml:jar:2.1.2.RELEASE:compile
    Line 93:  |  +- org.springframework:spring-oxm:jar:3.2.1.RELEASE:compile
    Line 99:  +- org.springframework:spring-test:jar:3.2.1.RELEASE:test
like image 741
jvG Avatar asked Dec 12 '13 12:12

jvG


People also ask

What is MimeMessage in Java?

MimeMessage uses the InternetHeaders class to parse and store the top level RFC 822 headers of a message. The mail. mime. address. strict session property controls the parsing of address headers.


1 Answers

bparry's answer still hold. But you should consider replacing it with jakarta.mail instead.

In addition, replace every instance of javax.mail with jakarta.mail in your codebase.

like image 103
Mahmoud K. Avatar answered Sep 28 '22 11:09

Mahmoud K.