Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception sending mail grails 3.1.4 rest-profile #17

Closed
jkolobok opened this issue Apr 22, 2016 · 6 comments
Closed

Exception sending mail grails 3.1.4 rest-profile #17

jkolobok opened this issue Apr 22, 2016 · 6 comments

Comments

@jkolobok
Copy link

jkolobok commented Apr 22, 2016

     mailService.sendMail {
            async true
            to user.email
            from brand.fromEmail
            subject "Your new password"
            html view: "/emails/new-password", model: [firstName: user.firstName, password: newPassword]
        }
Caused by: java.lang.NullPointerException: null
    at grails.plugins.mail.MailMessageContentRenderer.createTemplate(MailMessageContentRenderer.groovy:86)
    at grails.plugins.mail.MailMessageContentRenderer$_render_closure1.doCall(MailMessageContentRenderer.groovy:58)
    at grails.plugins.mail.MailMessageContentRenderer$RenderEnvironment.with(MailMessageContentRenderer.groovy:174)
    at grails.plugins.mail.MailMessageContentRenderer.render(MailMessageContentRenderer.groovy:57)
    at grails.plugins.mail.MailMessageBuilder.doRender(MailMessageBuilder.groovy:276)
    at grails.plugins.mail.MailMessageBuilder.html(MailMessageBuilder.groovy:294)
    at itracker.MailNotificationService$_sendMailWithNewPassword_closure1.doCall(MailNotificationService.groovy:23)
    at grails.plugins.mail.MailService.sendMail(MailService.groovy:51)
    at grails.plugins.mail.MailService.sendMail(MailService.groovy:57)
    at itracker.MailNotificationService.sendMailWithNewPassword(MailNotificationService.groovy:18)
    at itracker.controllers.UserController.$tt__doResetPassword(UserController.groovy:85)
    at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:96)
    at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)
    at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:96)
    at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)
    ... 11 common frames omitted
@graemerocher
Copy link
Member

Looks like it has a dependency on GSP, so you would have to add the GSP plugin

 compile 'org.grails:grails-plugin-gsp'

@AlexKovynev
Copy link

Maybe this is it?:

#14

@jkolobok
Copy link
Author

Nope. #14 is not it.
Adding compile 'org.grails:grails-plugin-gsp' helped.

@AlexKovynev
Copy link

It's a pity:)

@shresthaankit7
Copy link

Hello,
I face the same NullPointException issue. And after adding compile 'org.grails:grails-plugin-gsp' plugin, I faced another issue of :
Could not locate email view /email/JobFail in plugin [grails-plugin-gsp]

The view is in grails-app/view/email/JobFail and I'm using service as:

mailService.sendMail {
                to myRecepiants@gmail.com
                from myEmail@gmail.com
                subject mySubject
                html view:"/email/JobFail",model:[params:params],plugin:'grails-plugin-gsp'
            }

The issue doesn't occure when running through intellij but I face this issue if I deploy the war in tomcat.

@erichelgeson
Copy link

@shresthaankit7 remove the plugin:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants