Exception java.lang.NoClassDefFoundError JavaMail Tomcat v8.5

huangapple go评论59阅读模式
英文:

Exception java.lang.NoClassDefFoundError JavaMail Tomcat v8.5

问题

我正在尝试在Oracle上使用JavaMail发送自动电子邮件。我已经在Java构建路径中添加了外部JAR包(`mail.jar`和`activation.jar`)。我不知道我做错了什么,因为我收到了这个错误消息:

java.lang.ClassNotFoundException: javax.mail.internet.AddressException
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)

我正在使用Tomcat v8.5。
英文:

I'am trying to send an automatic email with JavaMail on Oracle. I added external JARs on Java Build Path (mail.jar and activation.jar). I don't know what I'm doing wrong because I get this error message:

java.lang.ClassNotFoundException: javax.mail.internet.AddressException
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)

I'm using Tomcat v8.5.

答案1

得分: 0

你应该添加Javax邮件依赖以使其正常工作。

英文:

You should add Javax mail dependency to make it work.

答案2

得分: 0

你需要将JavaMail库的Jars文件添加到Tomcat的lib文件夹中,或者在部署Web应用程序时将其包含在WAR文件中。将其添加到构建路径中只会在编译时可用。但是,根据部署的配置,它也可能会被部署,但显然在你的情况下不会。

英文:

You need to add the JavaMail library Jars either to the Tomcat lib folder, or it has to be part of your WAR file when you deploy your WebApp. Adding it to the Build Path makes it only available during compile time. Although, depending on the configuration for the Deployment, it could be deployed, too – but obviously, not in your case.

huangapple
  • 本文由 发表于 2020年5月2日 14:16:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/61555278.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定