Mailer插件抛出NullPointerException [英] Mailer plugin throws NullPointerException
问题描述
当我尝试使用Mailer插件(2.1-SNAPSHOT版本)时,如
When I try to use the Mailer Plugin (version 2.1-SNAPSHOT) as explained here everything seems fine, meaning all dependencies are resolved and there are no compilation errors.
无论何时执行此代码
MailerAPI mail = play.Play.application().plugin(MailerPlugin.class).email();
我在这行上得到一个NullPointerException.因为对plugin
的调用返回null
,所以产生了异常.
I get a NullPointerException on this line. The exception is generated because the call to plugin
returns null
.
关于这里发生什么的任何提示?
Any hints on what is going on here?
我正在使用Play 2.1-RC2,该应用程序是用Java编写的.
I'm using Play 2.1-RC2 and the app is written in Java.
推荐答案
如注释中所述,请检查是否已将1500:com.typesafe.plugin.CommonsMailerPlugin
添加到conf/play.plugins
中,以便按照文档.
As explained in the comments, please check that you add 1500:com.typesafe.plugin.CommonsMailerPlugin
to your conf/play.plugins
in order to register the plugin as explained in the documentation.
我认为Play应该抛出明确的消息,而不是NullPointerException
.
I think that Play should throw an explicit message instead of a NullPointerException
.
这篇关于Mailer插件抛出NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!