Skip to content
This repository was archived by the owner on Feb 9, 2019. It is now read-only.
This repository was archived by the owner on Feb 9, 2019. It is now read-only.

The method to set the recipient is not recognised. #92

Open

Description

@Archangelix

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 <iwanstr@gmail.com>")
    mail.setFrom("Peter Hausel <noreply@email.com>")
    //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?

Activity

  1. jroper commented on Oct 23, 2013

    @jroper
    Member

    MailerAPI extends MailerApiJavaInterop, which is where the method is defined. I didn't write the code, but I would guess the reason for this interface is that varargs in Java and Scala work differently, so the interface needs to be declared in Java.

    https://github.com/typesafehub/play-plugins/blob/master/mailer/src/main/scala/com/typesafe/plugin/MailerApiJavaInterop.java

    As for why this isn't working, could be you have different versions of the mailer plugin on the classpath, or maybe there's a scala compiler bug.

  2. Archangelix commented on Oct 23, 2013

    @Archangelix
    Author

    Thank you for the kind reply.

    These are the versions I'm using in my application. Is there any incompatibility between them?

    • play! 2.1.1
    • Java 1.7.0_40 and
    • Scala 2.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions