简体   繁体   English

java.lang.NoClassDefFoundError:javax / activation / DataContentHandler

[英]java.lang.NoClassDefFoundError: javax/activation/DataContentHandler

I'am developing a webapp using google app engine and maven in intelliJ IDEA. 我正在使用intelliJ IDEA中的Google App Engine和Maven开发一个Webapp。

So far so good until I tried to send an email using javax.mail and I get this error: 到目前为止,直到我尝试使用javax.mail发送电子邮件并得到以下错误为止:

java.lang.NoClassDefFoundError: javax/activation/DataContentHandler

I have already put the dependencies needed ( javax.activation & javax.mail ) in the pom.xml and still this error occurs. 我已经将所需的依赖项( javax.activationjavax.mail )放入pom.xml ,仍然发生此错误。

One way to fix it locally is to add "--add-modules java.activation" in vm options and when i run it locally its working fine and sending the email, but when I'am deploying the app its not working. 一种在本地修复它的方法是在vm选项中添加“ --add-modules java.activation”,当我在本地运行它时,它可以正常工作并发送电子邮件,但是当我部署该应用程序时,它不起作用。

And my question is, is there any way to pass the vm argument to maven or anywhere else so it will run without the error when I'll deploy the app. 我的问题是,有没有办法将vm参数传递给maven或其他任何地方,因此在我部署应用程序时它将运行而不会出现错误。

Or is there any other way to do this (with javax.mail or not) ? 还是有其他方法可以做到这一点(是否使用javax.mail )?

My java version is: openjdk 10.0.2 我的Java版本是: openjdk 10.0.2

You could do that with docker containers. 您可以使用docker容器做到这一点。 How to properly set the JVM options in a flexible GAE application 如何在灵活的GAE应用程序中正确设置JVM选项

Cause with maven you can not set the VM options for run time. 由于Maven,您无法为运行时设置VM选项。 Trying via docker could be key. 通过docker尝试可能是关键。

Just include the java.activation module in your application. 只需在您的应用程序中包含java.activation模块即可。

You can use either the older Oracle version , or the newer Eclipse version , which is essentially the same. 您可以使用较旧的Oracle版本较新的Eclipse版本 ,它们基本上是相同的。

(And you should consider upgrading to JDK 11.) (并且您应该考虑升级到JDK11。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse: java.lang.NoClassDefFoundError: javax/activation/DataHandler - Eclipse: java.lang.NoClassDefFoundError: javax/activation/DataHandler java.lang.NoClassDefFoundError:javax / validation / Validator - java.lang.NoClassDefFoundError: javax/validation/Validator java.lang.NoClassDefFoundError:javax / ejb / EJBObject - java.lang.NoClassDefFoundError: javax/ejb/EJBObject java.lang.NoClassDefFoundError:javax / mail / MessagingException - java.lang.NoClassDefFoundError: javax/mail/MessagingException java.lang.NoClassDefFoundError: javax/el/ELManager - java.lang.NoClassDefFoundError: javax/el/ELManager java.lang.NoClassDefFoundError:javax / persistence / Persistence - java.lang.NoClassDefFoundError: javax/persistence/Persistence java.lang.NoClassDefFoundError:javax / persistence / SharedCacheMode - java.lang.NoClassDefFoundError: javax/persistence/SharedCacheMode 异常:java.lang.NoClassDefFoundError: javax/activation/DataSource 发送邮件时 - Exception: java.lang.NoClassDefFoundError: javax/activation/DataSource when sending mail java.lang.NoClassDefFoundError: javax/servlet/ServletContext - java.lang.NoClassDefFoundError: javax/servlet/ServletContext java.lang.NoClassDefFoundError: javax/persistence/TableGenerators - java.lang.NoClassDefFoundError: javax/persistence/TableGenerators
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM