title: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.mail.javamail.SmartMimeMessage
body: <p>I'm getting below error while sending email from a java web project.<br/>
  IDE: <strong>eclipse</strong> <br/>
  Java version: <strong>openjdk version "1.8.0_212-3-redhat"</strong> <br/>
  Spring version: <strong>5.1.6.RELEASE</strong></p>
  
  <pre><code>java.lang.NoClassDefFoundError: Could not initialize class org.springframework.mail.javamail.SmartMimeMessage
  at org.springframework.mail.javamail.JavaMailSenderImpl.createMimeMessage(JavaMailSenderImpl.java:340)
  at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:373)
  at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:365)
  </code></pre>
  
  <p>Following is the filtered dependency tree for mail<br/>
  <a href="https://i.stack.imgur.com/EyJcx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EyJcx.png" alt="enter image description here"></a></p>
  
  <p><br/>I have tried the following:-</p>
  
  <ul>
  <li>Maven install </li>
  <li>Deleted existing tomcat server and added a new server in eclipse.</li>
  <li>changed local repository of maven for fresh dependencies download.</li>
  <li>deleted the project from eclipse workspace and deleted all eclipse settings and configuration file/folder then re-import the existing maven project</li>
  <li>checked for <code>org.springframework.mail.javamail.SmartMimeMessage</code> class in the <code>spring-context-support-5.1.6.RELEASE.jar</code> at project explorer as well as on file system<br/><a href="https://i.stack.imgur.com/ighGO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ighGO.png" alt="enter image description here"></a></li>
  </ul>
  
  <blockquote>
    <p>NOTE: This was a working code but suddenly I'm getting this error now.<br/> 
    No Compilation error in project and war is also able to successfully deployed on the server.</p>
  </blockquote>