Giter VIP home page Giter VIP logo

play-plugins's People

Contributors

alirussell avatar benmccann avatar blink-mirror avatar dylex avatar eirslett avatar erwan avatar eungjun-yi avatar freekh avatar ggrossetie avatar gmethvin avatar graingert avatar hermanbanken avatar jmparsons avatar joscha avatar jroper avatar kevinbosman avatar kinocz avatar kubudi avatar mbseid avatar mkurz avatar mortimerp9 avatar myyk avatar nraychaudhuri avatar ph2734 avatar rmmeans avatar stephenmuss avatar sunnykaka avatar takeshi avatar tkawachi avatar tsuyoshizawa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play-plugins's Issues

Mailer Plugin Error

I get this error when I try to use the mailer plugin.

My Build.scala:

val appDependencies = Seq(
  // Add your project dependencies here,
  "com.typesafe" %% "play-plugins-mailer" % "2.0.4"
)   

My ApplicationController.scala:

import play.api.Play.current
import com.typesafe.plugin.MailerPlugin
import com.typesafe.plugin.use

def index = Action {
  val mail = use[MailerPlugin].email
  mail.setSubject("MailAPage email")
  mail.addRecipient("Salil Wadnerkar <[email protected]>")
  mail.addFrom("Salil Wadnerkar <[email protected]>")
  //sends text/text
  mail.send( "text" )
  Ok(views.html.index(bookForm))
}

And here is the error:

[error] application - 

! @6b5j973e8 - Internal server error, for request [GET /] ->

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[RuntimeException: interface com.typesafe.plugin.MailerPlugin plugin should be available at this point]]
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.2]
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.2]
    at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
    at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.2]
    at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
Caused by: java.lang.RuntimeException: interface com.typesafe.plugin.MailerPlugin plugin should be available at this point
    at com.typesafe.plugin.package$$anonfun$use$1.apply(package.scala:13) ~[play-plugins-util_2.9.1-2.0.3.jar:2.0.4]
    at com.typesafe.plugin.package$$anonfun$use$1.apply(package.scala:13) ~[play-plugins-util_2.9.1-2.0.3.jar:2.0.4]
    at scala.Option.getOrElse(Option.scala:108) ~[scala-library.jar:0.11.3]
    at com.typesafe.plugin.package$.use(package.scala:13) ~[play-plugins-util_2.9.1-2.0.3.jar:2.0.4]
    at controllers.Application$$anonfun$index$1.apply(Application.scala:25) ~[classes/:na]
    at controllers.Application$$anonfun$index$1.apply(Application.scala:24) ~[classes/:na]

redis plugins throws NullPointerException

When getting a key from Redis with getOrElse, we sometimes ask for keys that are not yet in Redis.

In this specific case, the Redis plugins throws a NullPointerException because it tries to split a Null value returned by the Redis client for a non existent key.

I think the bug is line 105 of RedisClient.scala: client.get(key) should be wrapped in an Option before calling split("-").

How can I write a testcase to see if mailing works from my app

If I do the following ->

public static FakeApplication app;
  @BeforeClass
  public static void startApp() {
    app = Helpers.fakeApplication();
    Helpers.start(app);
  }

  @AfterClass
  public static void stopApp() {
    Helpers.stop(app);
  } 

@Test
public void sendEmail() {
    MailerPlugin mailplugin = play.Play.application().plugin(MailerPlugin.class);
    MailerAPI mail = mailplugin.email();
    mail.setSubject("test for assist app");
    mail.addRecipient();
    mail.addFrom();
    //sends html
    //mail.sendHtml("<html>this is a test email</html>" );
    //sends text/text
    mail.send( "text" );
    //sends both text and html
    //mail.send( "text", "<html>html</html>");  
}

I have a nummpointerexception at MailerAPI mail = mailplugin.email();
which means the factory method -> play.Play.application().plugin(MailerPlugin.class);
does not seem to return the plugin class.

I am new to play is this how I supposed to do this ?

thanks

Can't install plugin in Play 2.1.0

Hi, I just tried to install this plugin for my Play 2.1.0 Java application but it's not working at compilation.

I give you the error code I get :

sbt.ResolveException: unresolved dependency: com.typesafe#play-plugins-mailer_2.10;2.0.4: not found

I'm a new Play user, so I don't know if the problem comes from me, or if the plugin has a small error.

Thanks you all !

Error reporting is broken in dust plugin

If the dust plugin hits an error while compiling a template, the error reporting does not work correctly. It used to show the line number and code snippet in the browser, but now it just shows:

NumberFormatException: empty String

Here's the stack trace:

java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:992) ~[na:1.6.0_31]
    at java.lang.Double.parseDouble(Double.java:510) ~[na:1.6.0_31]
    at scala.collection.immutable.StringLike$class.toDouble(StringLike.scala:234) ~[scala-library.jar:0.12.0]
    at scala.collection.immutable.StringOps.toDouble(StringOps.scala:31) ~[scala-library.jar:0.12.0]
    at com.typesafe.plugin.DustTasks$class.compile(DustTasks.scala:48) ~[na:na]
    at com.typesafe.plugin.DustPlugin$.compile(DustPlugin.scala:7) ~[na:na]

Looking at the code, it looks like this line in DustTasks is suspicious:

val line = ScriptableObject.getProperty(jsError, "fileName").toString.toDouble.toInt

It would be easy to check that the fileName property is not null/empty, but why are we converting something called fileName to an Int?

Dust sample doesn't work

Hi,

I got the repo in order to try the dust sample app, but routes are not resolved:

Request URL:http://localhost:9000/assets/example.tl.js
Request Method:GET
Status Code:404 Not Found

Configuration:
Play 2.0.3

setFrom method unavailable in Scala

I have added the plugin to my conf/play.plugins file, and I have the following in my Build.scala:

"com.typesafe" %% "play-plugins-mailer" % "2.1-RC2"

I'm using Play 2.1 with Scala 2.10

I attempt to call mail.setFrom("...") and the compiler then tells me that setFrom is not a member of com.typesafe.plugin.MailerAPI.

Here are the imports (relevant to this issue) at the top of my file:

import play.api.Play.current
import com.typesafe.plugin._

I've also tried this with 2.1.0 version instead of 2.1-RC2 and I encounter the same error.

Code:
val mail = use[MailerPlugin].email
mail.setSubject("foo")
mail.setFrom("foo") // this fails!!
mail.sendHtml("foo</html")

p.s. It also says that "setRecipient" is not a member of MailerAPI.

addRecipient should be setRecipients

Calling addRecipient multiple times causes the mail to be sent to the last recipient only, from the method name it's unclear that this method should only be called once with all recipients.

I suggest to rename the method to setRecipients (maybe with a deprecation of the old method)

[Dust] Generated template doesn't work on Windows

Hello,

Thanks a lot for this plugin.

This issue is related to https://groups.google.com/forum/?fromgroups&hl=fr#!searchin/play-framework/2.0$20dust/play-framework/2n4aYP45H6Q/Q3tE5YSlOJIJ

There is a little issue using it on Windows. The generated template looks like this :

(function(){dust.register("D:\dev\play-plugins\dust\sample\app\assets\example.tl",body_0);...

which doesn't work !

The mistake is in https://github.com/typesafehub/play-plugins/blob/master/dust/src/main/scala/com/typesafe/plugin/DustTasks.scala.
The last character added to assertDir is /, before replacement by "" which works on Linux/Mac but not on Windows ;)

val msg = compile(sourceFile.getPath.replace(assetsDir.getPath + "/", ""), IO.read(sourceFile)).left.map {
              case (msg, line, column) => throw AssetCompilationException(Some(sourceFile),
                msg,
                line,
                column)
            }.right.get

Thanks a lot in advance.

F.

Email Attachment

Hi There, I have been using your plugin since 2.0.1 with absolutely no issues. However, I would like to know if there is a way to send an attachment with an email? I have tried your mail.addSubject(String, Object) method hoping that this might send the attachment with the subject. However it doesn't work and im sure im doing something silly. Is there a way to email attachments with this plugin?

Statsd plugin UnsupportedClassVersionError. Is java 7 required?

Trying to use the statsd plugin and getting this error on Mac Java 6 latest. Is it intended only to work for java 7?

"com.typesafe.play.plugins" %% "play-statsd" % "2.1.0"

scala.MatchError: java.lang.UnsupportedClassVersionError: play/modules/statsd/StatsdFilter : Unsupported major.minor version 51.0 (of class java.lang.UnsupportedClassVersionError)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:103) ~[play_2.10.jar:2.1.1]

Cannot send mail to *.outlook.com

Cannot send mail to
smtp.host=podXXXXX.outlook.com
smtp.port=587

smtp.ssl=true

smtp.tls=yes
smtp.user="[email protected]"
smtp.password="bar+"

I have even made sure that the from address is the same as the smtp.user.
Please advise.

The name used in dust.js compilation should strip the file extension

The dust.compile function takes two arguments: the template body and the template name. The convention in dust is that the name should not include any file extension; unfortunately, the play dust plugin is including the name.

This means rendering calls are a bit more verbose/repetitive:

dust.render('hello.tl', ...)

instead of

dust.render('hello', ...)

And partials are worse too:

{>"hello.tl"}

instead of

{>hello}

I think it's just a one line change to strip the extension in DustTasks.scala.

redis pool blocked when plugin is used in tests

I wrote tests for my authorization controller and every time I run more than one test concurrently there is a
JedisConnectionException: Could not get a resource from the pool (Pool.java:22)
[error] redis.clients.util.Pool.getResource(Pool.java:22)
[error] org.sedis.Pool.withClient(sedis.scala:71)
...
[error] Pool not open

Mailer plugin prevents standalone execution

If you add the typesafe mailer plugin to Build.scala on a new play 2.0.3/2.0.4 project, you lose the ability to execute standalone play apps that start the framework programatically.

For example you create a new Application, and add this to Build.scala

"com.typesafe" %% "play-plugins-mailer" % "2.0.4"

Then create this class:

public class QueueWorker {
    public static void main(String[] args) {
        Application application = new Application(new File(args[0]), QueueWorker.class.getClassLoader(), null, Mode.Dev());
        Play.start(application);
    }
}

Compile and recreate IDE settings, and then execute said class, you get the following error:

Exception in thread "main" net.sf.ehcache.ObjectExistsException: Cache play already exists
    at net.sf.ehcache.CacheManager.addCache(CacheManager.java:990)
    at play.api.cache.EhCachePlugin.x$3(Cache.scala:111)
    at play.api.cache.EhCachePlugin.cache(Cache.scala:109)
    at play.api.cache.EhCachePlugin.onStart(Cache.scala:127)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at play.api.Play$.start(Play.scala:60)
    at play.api.Play.start(Play.scala)
    at jobs.QueueWorker.main(QueueWorker.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

This issue originated here joscha/play-authenticate#23

Publish compatible with Play 2.2 / sbt 0.13.0

Just tried out the Play 2.2 milestone release. One issue I had with it is that my plugins aren't available for it. Would be great to get a version of this published that's compatible. Plugins built with sbt 0.13.0-RC4 should be compatible with sbt 0.13.0.

play-plugins-mailer for scala 2.10 in repo

Could we get a 2.10 version of play-plugins-mailer in the repo? I'm trying to switch to play-2.1-RC1 but I'm getting this issue:

sbt.ResolveException: unresolved dependency: com.typesafe#play-plugins-mailer_2.10;2.0.4: not found

play `dist-unzip` generate java.lang.UnsatisfiedLinkError Unable to load library 'c': The specified module could not be found.

play dist-unzip generate this error :

[error] {file:/C:/myProjects/forms/} 
forms/*:dist-unzip: java.lang.UnsatisfiedLinkError: 
Unable to load library 'c': The specified module could not be found.

Configurqtions : Windows 7 / Play 2.0.3 / play-plugins-sbtgoodies 0.1 and 0.2

Original discussion is here :
https://groups.google.com/forum/?fromgroups=#!topic/play-framework/HasouMg_iew

setRecipient/setFrom Scala Play 2.2.1

setRecipient/setFrom are not working with Scala, i tried a clean setup with Play 2.2.1...i had to use addRecipient/addFrom after a small google research...

StatsdFilter java.io.IOException: Operation not permitted

Statsd seems to be working for me, but upon inspection of the application logs I found the following exception and could not reproduce it.

It is either something is being sent to DatagramSocket that it cannot process (incomplete data perhaps), or the underlying system is blocking that connection (but only for that send as otherwise stats are coming through fine).

[ERROR] - from application in play-akka.actor.default-dispatcher-189 

java.io.IOException: Operation not permitted
    at java.net.PlainDatagramSocketImpl.send(Native Method) ~[na:1.7.0_10]
    at java.net.DatagramSocket.send(DatagramSocket.java:676) ~[na:1.7.0_10]
    at play.modules.statsd.api.RealStatsdClientCake$class.play$modules$statsd$api$RealStatsdClientCake$$socketSend(StatsdClientCake.scala:113) ~[com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.RealStatsdClientCake$$anonfun$send$1.apply(StatsdClientCake.scala:90) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.RealStatsdClientCake$$anonfun$send$1.apply(StatsdClientCake.scala:90) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.StatsdClient$class.play$modules$statsd$api$StatsdClient$$maybeSend(StatsdClient.scala:108) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.StatsdClient$$anonfun$increment$1.apply$mcV$sp(StatsdClient.scala:42) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.StatsdClient$class.safely(StatsdClient.scala:117) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.StatsdClient$class.increment(StatsdClient.scala:42) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.Statsd$.increment(StatsdClient.scala:128) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.StatsdFilter$$anon$1.apply(StatsdFilter.scala:52) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.modules.statsd.api.StatsdFilter$$anon$1.apply(StatsdFilter.scala:31) [com.typesafe.play.plugins.play-statsd_2.10-2.1.0.jar:2.1.0]
    at play.api.mvc.FilterChain$$anon$2.apply(Filters.scala:78) [play.play_2.10-2.1.0.jar:2.1.0]
    at play.api.mvc.FilterChain$$anon$2.apply(Filters.scala:75) [play.play_2.10-2.1.0.jar:2.1.0]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$17.apply(PlayDefaultUpstreamHandler.scala:347) [play.play_2.10-2.1.0.jar:2.1.0]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$17.apply(PlayDefaultUpstreamHandler.scala:347) [play.play_2.10-2.1.0.jar:2.1.0]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) [org.scala-lang.scala-library-2.10.0.jar:na]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) [org.scala-lang.scala-library-2.10.0.jar:na]
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:137) [com.typesafe.akka.akka-actor_2.10-2.1.0.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1417) [org.scala-lang.scala-library-2.10.0.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) [org.scala-lang.scala-library-2.10.0.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [org.scala-lang.scala-library-2.10.0.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) [org.scala-lang.scala-library-2.10.0.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [org.scala-lang.scala-library-2.10.0.jar:na]

guice-annotations utils dependency breaks jclouds and other guice 3.0-dependent libs

I believe that including the guice-annotations project on the classpath breaks any libraries that use Guice 3.0. I believe that it does this by providing incompatible Provider annotation implementations.

This is a problem because this repo's utils package uses guice-annotations. Is it possible to remove or update that dependency?

To reproduce:

  • Clone this Play 2.0.4 project that uses the cedarsoft dependency directly as well as the latest jclouds.
  • Run the project and hit localhost:9000 in your browser
  • Observe the massive Guice stacktrace in your play2 console
  • Uncomment the libraryDependency on guice-annotations in Build.scala
  • Run the project and hit localhost:9000 again.
  • Observe that the page is rendered without a stack trace.

support configuration of redis host/port user/pass via a single URI property

would make using this on heroku easier, since they give you a redis url. so application conf could look like

redis.url=${REDISTOGO_URL}

and used like...

val redisUrl = new URI(current.config.getString("redis.url").get)
val redisPassword: Option[String] = Option(redisUrl.getUserInfo).map(_.split(":").apply(1))

lazy val redisPool = createRedisPool()

def redisConnection(): Jedis = {
val redis = new Jedis(redisUrl.getHost, redisUrl.getPort)
for (p <- redisPassword) {
redis.auth(p)
}
log.info("redisConnection()")
redis
}

How to get EmailException

The MailerAPI send() method returns void and doesn't declare any exceptions. Apparently internally there is a Future somewhere and a EmailException, but I don't get that. All I get is a log entry in my log file saying

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:465

Now I need to be able to detect this so that I can do whatever (retry, use a fallback mail server, escalate the exception).
Also, there is another open issue where someone asks how to test the mailer in a unit test.

I guess I have to use the commons mailer (or whatever package) directly for now.

Outdated Mailer documentation

The line to add to Build.scala should be "com.typesafe" %% "play-plugins-mailer" % "2.0" (notice the double percent characters)

The line to add to play.plugins should look like 1001:com.typesafe.plugin.notifiers.CommonsMailerPlugin

The sendHtml("<html>html</html>") function does not exist in the MailerPlugin class. send(" ", "<html>html</html>") can be used instead. (yes, the first argument mustn't be an empty string).

EmailException occurs when email body is an empty string

Hi,

I tested the following code snippet in play 2.0.4 and encounter an EmailException. I verified that my setup works by supplying a non-empty string. I believe it is a valid use case because people often send one liners via the subject line and leave the body empty.

Code:
val mail = use[MailerPlugin].email
mail.setSubject(subject)
mail.addRecipient(to: _*)
mail.addFrom(from)
mail.send("")

Result:
[EmailException: Invalid message supplied]

sedis_2.10.0 not in repo

I'm trying to get the Redis plugin up and running on play 2.1. To find the correct plugin build I had to add "com.typesafe" %% "play-plugins-redis" % "2.1-1-RC2"to my dependencies. This seems to work fine, but then Play is unable to find Sedis. It's looking in the following path: http://repo.typesafe.com/typesafe/releases/org/sedis/sedis_2.10.0/1.1.1/sedis_2.10.0-1.1.1.pom

I check the directory myself and there doesn't seem to be anything beyond 2.9.2. Is a build going to be put up soon?

Emails sent from Heroku get incorrect charset

We run Play 2.0.3 with com.typesafe.plugin.CommonsMailerPlugin. Sending emails that contain Swedish characters (åäö) works well on my development environment, but on Heroku (using SendGrid) the Swedish characters are all replaced by question marks. Calling mail.setCharset("UTF-8"); does not help.

This has been reported by other users on Grokbase. Nilanjan asked for a GitHub issue to be raised and I could not find any so I created one.

On Grokbase, Andreas Fürer reported that adding "-Dfile.encoding=UTF8" to JAVA_OPTS and SBT_OPTS on Heroku fixed the problem, but that did not work for me unfortunately.

The method to set the recipient is not recognised.

Hi,
I'm still relatively new to Scala and Play. Please bear with me if I'm missing anything here. I'm getting an error while trying to set the recipient.

[RuntimeException: java.lang.NoSuchMethodError: com.typesafe.plugin.MailerAPI.setRecipient([Ljava/lang/String;)Lcom/typesafe/plugin/MailerAPI;]

This is the method calling the mailer API:

  def send = Action { implicit req =>
    val mail = use[MailerPlugin].email
    mail.setSubject("mailer")
    mail.setRecipient("Iwan Satria <[email protected]>")
    mail.setFrom("Peter Hausel <[email protected]>")
    //sends html
    mail.sendHtml("<html>html</html>")
    Ok(views.html.homepage(loginForm)(session))
  }

I have checked the codes in MailerPlugin.scala and the method does exist in the MailerBuilder trait but not in MailerAPI.

I'm not sure where the problem is. Is there anything else that I need to check?

Redis Plugin Cache.getAs[T](redisKey)

Hi

Is it possible to add getAsT to cache object .
at the moment it not supported for play2.1.3

[warn] application - could not deserialize key ex:java.lang.ClassNotFoundException: MyClass
java.lang.ClassNotFoundException: MyClass

Redis cache always uses Serializable/ObjectOutputStream

I am using the play redis cache to store Strings (JSON, actually).
I'd like those strings to be useful for non-Java applications but noticed that the cache always stores them as below:

redis 127.0.0.1:6379> get somekeyhere
"oos-rO0ABXQAgHsidHlwZSI6ImN1c3RvbWVyIiwidXNlcl91dWlkIjoiOGMxMzVjMDgtMjkzZi00NjQ3LTgyND98BjIiwiZW1haWwiOiJzYWxseUBjdXN0b21lci50ZXN0IiwiZGlzcGxheU5hbWUiOiJTYWxseSBCdXllciJ9"

Serializing direct to the cache (i.e. bypassing the redis plugin) works for strings no problem.

The code at https://github.com/typesafehub/play-plugins/blob/master/redis/src/main/scala/com/typesafe/plugin/RedisPlugin.scala shows the reason why: the type test is applied to Serializable first, so the test for String is never applied:

   if (value.getClass.isInstanceOf[Serializable]) {
      oos = new ObjectOutputStream(baos)
      oos.writeObject(value)
      oos.flush()
   } else if (value.getClass.isInstanceOf[String]) {
      dos = new DataOutputStream(baos)   // <-- NEVER GETS HERE!
      dos.writeUTF(value.asInstanceOf[String])
      prefix = "string"

The solution is to put the Serializable test at the end, after String, Int, Long, Boolean.

Found interface play.api.Application, but class was expected

I guess it's because I use it with Play 2.1.0-RC1.

java.lang.IncompatibleClassChangeError: Found interface play.api.Application, but class was expected at com.typesafe.plugin.CommonsMailerPlugin.enabled(MailerPlugin.scala:337) ~[play-plugins-mailer_2.9.1-2.0.4.jar:2.0.4] at play.api.WithDefaultPlugins$$anonfun$plugins$1$$anonfun$apply$9.apply(Application.scala:127) ~[play_2.10-2.1-RC1.jar:2.1-RC1] at play.api.WithDefaultPlugins$$anonfun$plugins$1$$anonfun$apply$9.apply(Application.scala:124) ~[play_2.10-2.1-RC1.jar:2.1-RC1] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na] at scala.collection.immutable.List.foreach(List.scala:309) ~[scala-library.jar:na] [19:04:23.215] [error] [application] - Error while rendering default error page scala.MatchError: java.lang.IncompatibleClassChangeError: Found interface play.api.Application, but class was expected (of class java.lang.IncompatibleClassChangeError) at play.api.GlobalSettings$class.onError(GlobalSettings.scala:102) ~[play_2.10-2.1-RC1.jar:2.1-RC1] at play.api.DefaultGlobal$.onError(GlobalSettings.scala:160) [play_2.10-2.1-RC1.jar:2.1-RC1] at play.core.server.Server$class.logExceptionAndGetResult$1(Server.scala:74) [play_2.10-2.1-RC1.jar:2.1-RC1] at play.core.server.Server$$anonfun$getHandlerFor$2.apply(Server.scala:81) [play_2.10-2.1-RC1.jar:2.1-RC1] at play.core.server.Server$$anonfun$getHandlerFor$2.apply(Server.scala:81) [play_2.10-2.1-RC1.jar:2.1-RC1] at scala.util.Either$LeftProjection.map(Either.scala:377) [scala-library.jar:na]

Mailer plugin for 2.1 snapshot please

I'm on Play 2.1 snapshot with Scala 2.9.2

The mailer plugin is built against Play 2.0 with Scala 2.9.2

Eclipse blows up (red lines all over the place) since there are 2 versions of Play on the classpath, not to mention a bunch of ancillary jars (scala arm 2.9.1) that I have absolutely no need for/get in the way/blow up distribution size.

Thanks

Inject plugin causes play reload to fail

Inject plugin is using Class.forName() everywhere, instead of using the applications classloader, and this is resulting in very weird behaviour, ultimately resulting in classes not being reloaded when they are changed, recompiled and the application being reloaded.

Make dist-unzip dependent upon dist

Hi Peter, thanks so much for the dist-unzip task. It's really simplified things for me. It would be quite nice if I could just run dist-unzip instead of having to run both dist and dist-unzip every time. Is it possible to declare dist as a dependency of dist-unzip?

Wrong Java version

The following error is thrown when trying to use the plugin in a Play 2.0.2 application on JDK 1.6. As seen on the Play mailing-list it appears that this plugin has Java 7 dependencies.

But since Play2 still has a number of unresolved bugs with Play 7, upgrading is not a solution.

    play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[UnsupportedClassVersionError: com/typesafe/plugin/MailerApiJavaInterop : Unsupported major.minor version 51.0]]
        at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.2]
        at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.2]
        at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
        at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.2]
        at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
    Caused by: java.lang.UnsupportedClassVersionError: com/typesafe/plugin/MailerApiJavaInterop : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.6.0_33]
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) ~[na:1.6.0_33]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615) ~[na:1.6.0_33]
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) ~[na:1.6.0_33]
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) ~[na:1.6.0_33]
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58) ~[na:1.6.0_33]

Mailer plugin sends plain text as text/html

The mailer plugin sends text messages as conten-type text/html, thus lossing all the formatting of the text message.

This is because the mailer plugin creates

if (bodyHtml == null || bodyHtml == "") {
      val e = new MultiPartEmail()
      e.setMsg(bodyText)
      e
    }

should be

if (bodyHtml == null || bodyHtml == "") {
      val e = new SimpleEmail()
      e.setMsg(bodyText)
      e
    }

to properly send the text email as text/plain

cannot find symbol

I did everything like in mailer README.
I added "com.typesafe" %% "play-plugins-mailer" % "2.1-RC2" to my dependencies.
I added 1500:com.typesafe.plugin.CommonsMailerPlugin to my conf/play.plugins
I also added configuration in conf/application.conf file:

smtp.host=smtp.gmail.com
smtp.port=587
smtp.ssl=true
smtp.tls=true
smtp.username="[email protected]"
smtp.password="xxxxxxx"

I'm still getting error showed below. I tried to change 2.1-RC2 to 2.1.0 but it didn't work. How can I proper configure mailer?

error: cannot find symbol
[error]         mail.setRecipient("Peter Hausel Junior <[email protected]>","[email protected]");
[error]             ^
[error]   symbol:   method setRecipient(String,String)
[error]   location: variable mail of type MailerAPI
[error] 1 error
[error] (compile:compile) javac returned nonzero exit code
[error] application - 

! @6fc9m5829 - Internal server error, for (GET) [/] ->

sbt.PlayExceptions$CompilationException: Compilation error[error: cannot find symbol]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15$$anonfun$apply$16.apply(PlayReloader.scala:349) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15$$anonfun$apply$16.apply(PlayReloader.scala:349) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15.apply(PlayReloader.scala:349) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15.apply(PlayReloader.scala:346) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:na]

[Guice] JUnit using running(fakeApplication()) in IntelliJ is broken

Play 2.0.3 Java with dependency to Gucie plugin 2.0.3 breaks running JUnit tests that uses running(fakeApplication()) with the following exception:

net.sf.ehcache.ObjectExistsException: Cache play already exists
    at net.sf.ehcache.CacheManager.addCache(CacheManager.java:990)
    at play.api.cache.EhCachePlugin.x$3(Cache.scala:111)
    at play.api.cache.EhCachePlugin.cache(Cache.scala:109)
    at play.api.cache.EhCachePlugin.onStart(Cache.scala:127)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at play.api.Play$.start(Play.scala:60)
    at play.api.Play.start(Play.scala)
...

The cause of the problem is probably caused by play.plugins (referring to EhCachePlugin) being found multiple times on class path.

The problem can be reproduced like this:

Create new empty Java Play 2.0.3 project.

Add dependency to Guice module:

"com.typesafe" % "play-plugins-guice" % "2.0.3"

Create IntelliJ config:

play idea

Load project into IntelliJ and create the following JUnit test:

import org.junit.Test;

import static play.test.Helpers.fakeApplication;
import static play.test.Helpers.running;

public class PluginProblemTest {

    @Test
    public void test() {
        running(fakeApplication(), new Runnable() {
            public void run() {
                System.out.println("Will not work when we have dep to Guice plugin");
            }
        });
    }
}

Run the test from within IntelliJ and it will fail with the exception above

Mailer plugin mock mailer

The mailer in Play 1.x had a nice mock mailer useful for development and testing. It would be neat to see that added to this plugin.

SBT Goodies broken if project has non-Play subproject

I have a sub-project in my Build.scala which causes SBT to error out. This works if my sub-project is a PlayProject, but breaks things if my project is a standard SBT Project.

val dataProject = Project(
  appName + "-data",
  file("data"),
  settings = Defaults.defaultSettings ++ Seq (
    libraryDependencies := dataDeps)
)

The error I get it:

$ play
[info] Loading project definition from /home/bmccann/src/myproj/project
[error] Reference to undefined setting: 
[error] 
[error]   myproj-data/*:play-dist from myproj-data/*:dist-unzip
[error]  
[error] Use 'last' for the full log.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.