Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6923155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:29:57+00:00 2026-05-27T10:29:57+00:00

I have my service in the proper folder (i have an email plugin, which

  • 0

I have my service in the proper folder (i have an email plugin, which works good in a controller, iv tested it)

class SendMailService {

    static transactional = false

    def serviceMethod() {

                sendMail {     
                  to "xxx"
                  from "xxx"
                  subject "Hello Fred"     
                  body 'How are you?' 
                }

    }
}

and i’m calling it inside a Quartz Plugin job:

class SendAlertJob {
    def timeout = 5000l // execute job once in 5 seconds

    def execute() {

        def SendMailService

        SendMailService.serviceMethod()

    }
}

and getting this error:

2011-12-12 20:37:59,781 [quartzScheduler_Worker-3] ERROR listeners.ExceptionPrinterJobListener  - Exception occured in job: GRAILS_JOBS.tv_megazineplus.SendAlertJob
org.quartz.JobExecutionException: Cannot invoke method serviceMethod() on null object [See nested exception: java.lang.NullPointerException: Cannot invoke method serviceMethod() on null object]
    at org.codehaus.groovy.grails.plugins.quartz.GrailsJobFactory$GrailsTaskClassJob.execute(GrailsJobFactory.java:81)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
Caused by: java.lang.NullPointerException: Cannot invoke method serviceMethod() on null object
    at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    at tv_megazineplus.SendAlertJob.execute(SendAlertJob.groovy:11)
    at sun.reflect.GeneratedMethodAccessor287.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:186)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:171)
    at org.codehaus.groovy.grails.plugins.quartz.GrailsJobFactory$GrailsTaskClassJob.execute(GrailsJobFactory.java:77)
    ... 2 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:29:57+00:00Added an answer on May 27, 2026 at 10:29 am

    The SendMailService should be declared at the class level for it to be autowired/injected.

    class SendAlertJob {
        def timeout = 5000l // execute job once in 5 seconds
    
        def SendMailService
    
        def execute() {
            SendMailService.serviceMethod()
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created one windows service which send an email notifications to users (list
I currently have service classes that look something like this public class UserService :
I have several service classes that have static methods and offer a service to
We have a Silverlight app which we wrote which calls a Silverlight-enabled data service.
I have a wcf web service which is configured for JSON. But my data
I have written a sample web service, which consist of certain .aspx pages. I
I am new to web services. I have written a rest web service which
I have a service which polls a queue very quickly to check for more
I have a Windows service which performs a fairly long running task. At the
In java i have created a JAX- web service, which is up and running,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.