【问题标题】:Mailer plugin throws NullPointerExceptionMailer 插件抛出 NullPointerException
【发布时间】:2013-01-13 20:47:27
【问题描述】:

当我按照here 的解释尝试使用 Mailer 插件(版本 2.1-SNAPSHOT)时,一切似乎都很好,这意味着所有依赖项都已解决并且没有编译错误。

但是当这段代码被执行时

MailerAPI mail = play.Play.application().plugin(MailerPlugin.class).email();

我在这条线上得到一个 NullPointerException。产生异常是因为对plugin 的调用返回null

关于这里发生了什么的任何提示?

我使用的是 Play 2.1-RC2,应用是用 Java 编写的。

【问题讨论】:

  • 您是否将1500:com.typesafe.plugin.CommonsMailerPlugin 添加到您的conf/play.plugins 中?
  • 就这么简单...docs 的第一行...谢谢!

标签: java playframework playframework-2.1


【解决方案1】:

如 cmets 中所述,请检查您是否将 1500:com.typesafe.plugin.CommonsMailerPlugin 添加到您的 conf/play.plugins 以便按照 documentation 中的说明注册插件。

我认为 Play 应该抛出一个明确的消息而不是 NullPointerException

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-10
    • 2019-05-22
    • 2017-08-11
    • 2013-09-07
    • 2013-06-18
    • 2016-07-07
    • 2014-10-02
    相关资源
    最近更新 更多