问题
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:
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.
来源:https://stackoverflow.com/questions/14307978/mailer-plugin-throws-nullpointerexception