huahsin68
huahsin68

Reputation: 6989

How to resolve javax/mail/MessagingException?

I am using eclipse indigo to run my tomcat server, when I am launching tomcat server, the tomcat server successfully up and running, but with error shown in the console.

ERROR  - ContextLoader[177]: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'com.huahsin68.MyBoc' defined in class path resource [my-spring.xml]: Class that bean class [com.huahsin68.MyBocImp] depends on not found; nested exception is java.lang.NoClassDefFoundError: javax/mail/MessagingException
java.lang.NoClassDefFoundError: javax/mail/MessagingException

It seems like the MessagingException wasn't found. I have check in the Java Build Path > Libraries, I notice that javax.mail_1.4.0.v200105080615.jar was there. This jar file is locate under eclipse > plugins folder. Is there anything solution to rectify this problem?

THanks @!

Upvotes: 12

Views: 68375

Answers (5)

AmitG
AmitG

Reputation: 609

For those conning late in this .. I got the same error resolved by adding below jar. geronimo-javamail_1.4_mail-1.8.3.jar

Upvotes: 0

Tim
Tim

Reputation: 43334

For gradle/android users, in build.gradle (Module app):

compile 'javax.mail:mail:1.4.1' 

Upvotes: 7

Dawood ibn Kareem
Dawood ibn Kareem

Reputation: 79847

I had a similar problem, running tomcat stand-alone (that is, not through Eclipse). I copied mail-1.4.jar to my tomcat/lib directory. This worked for me.

Upvotes: 2

Benny Code
Benny Code

Reputation: 54880

With Maven, you can add the following dependency:

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

Upvotes: 20

Abdullah Jibaly
Abdullah Jibaly

Reputation: 54810

Try the following:

  1. Download the java mail jars from: http://www.oracle.com/technetwork/java/javamail/index-138643.html
  2. Add the jars to your WEB-INF/lib folder
  3. Add the jars to Java Build Path > Libraries

That should do it.

Upvotes: 11

Related Questions