Mailer plugin throws NullPointerException

2019-06-23 23:05发布

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.

However when this code is executed

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

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?

I'm using Play 2.1-RC2 and the app is written in Java.

1条回答
神经病院院长
2楼-- · 2019-06-23 23:39

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.

I think that Play should throw an explicit message instead of a NullPointerException.

查看更多
登录 后发表回答