如何在Play 2.4中使用CommonsMailerPlugin

时间:2015-07-15 02:42:04

标签: java playframework playframework-2.4

我刚刚从Play 2.2-> play 2.3迁移了我的应用程序,现在我无法从游戏2.3-> play 2.4迁移它,特别是使用CommonsMailerPlugin。我收到以下运行时错误:

play.api.UnexpectedException: Unexpected exception[ClassNotFoundException: play.api.libs.mailer.CommonsMailerPlugin]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:165) ~[play-server_2.11-2.4.0.jar:2.4.0]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:121) ~[play-server_2.11-2.4.0.jar:2.4.0]
at scala.Option.map(Option.scala:146) ~[scala-library-2.11.6.jar:na]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:121) ~[play-server_2.11-2.4.0.jar:2.4.0]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:119) ~[play-server_2.11-2.4.0.jar:2.4.0]
at scala.util.Success.flatMap(Try.scala:230) ~[scala-library-2.11.6.jar:na]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:119) ~[play-server_2.11-2.4.0.jar:2.4.0]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111) ~[play-server_2.11-2.4.0.jar:2.4.0]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.11.6.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.11.6.jar:na]
    Caused by: java.lang.ClassNotFoundException: play.api.libs.mailer.CommonsMailerPlugin
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_45]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_45]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_45]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_45]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_45]
at play.utils.Reflect$.getClass(Reflect.scala:142) ~[play_2.11-2.4.0.jar:2.4.0]
at play.api.Plugins$$anonfun$loadPlugins$1.apply(Plugins.scala:88) ~[play_2.11-2.4.0.jar:2.4.0]
at play.api.Plugins$$anonfun$loadPlugins$1.apply(Plugins.scala:87) ~[play_2.11-2.4.0.jar:2.4.0]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) ~[scala-library-2.11.6.jar:na]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) ~[scala-library-2.11.6.jar:na]}

2 个答案:

答案 0 :(得分:6)

Just follow instruction as per Play 2.4 Mailer and remove a reference to the Mailer plugin from conf/play.plugins file.

In my case it was the only line in the file, so I deleted the file.

答案 1 :(得分:0)

据我所知,Play 2.4有新版本的Mailer插件。 并且有一个包更改:

  

com.typesafe.plugin.CommonsMailerPlugin - 版本2.4.1   play.api.libs.mailer.CommonsMailerPlugin - 版本2.3.x