eclipse 如何解决javax/mail/MessagingException?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6743031/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to resolve javax/mail/MessagingException?
提问by huahsin68
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.
我正在使用 eclipse indigo 运行我的 tomcat 服务器,当我启动 tomcat 服务器时,tomcat 服务器成功启动并运行,但在控制台中显示错误。
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?
似乎没有找到 MessagingException 。我检查了 Java Build Path > Libraries,我注意到 javax.mail_1.4.0.v200105080615.jar 在那里。这个 jar 文件位于 eclipse > plugins 文件夹下。有什么解决方案可以纠正这个问题吗?
THanks @!
谢谢 @!
回答by Benny Neugebauer
With Maven, you can add the following dependency:
使用 Maven,您可以添加以下依赖项:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
</dependency>
回答by Abdullah Jibaly
Try the following:
请尝试以下操作:
- Download the java mail jars from: http://www.oracle.com/technetwork/java/javamail/index-138643.html
- Add the jars to your WEB-INF/lib folder
- Add the jars to Java Build Path > Libraries
- 从以下位置下载 java 邮件 jar:http: //www.oracle.com/technetwork/java/javamail/index-138643.html
- 将 jars 添加到您的 WEB-INF/lib 文件夹
- 将 jars 添加到 Java Build Path > Libraries
That should do it.
那应该这样做。
回答by Tim
For gradle/android users, in build.gradle (Module app)
:
对于 gradle/android 用户,在build.gradle (Module app)
:
compile 'javax.mail:mail:1.4.1'
回答by Dawood ibn Kareem
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.
我有一个类似的问题,独立运行 tomcat(即,不是通过 Eclipse)。我将 mail-1.4.jar 复制到我的 tomcat/lib 目录。这对我有用。
回答by AmitG
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
对于那些在这方面迟到的人..我通过添加下面的jar解决了同样的错误。geronimo-javamail_1.4_mail-1.8.3.jar