5 Replies Latest reply on Aug 14, 2017 2:38 PM by carlos_coa

    Coldfusion 11 Scheduled Task Event Handler

    RandyCF Level 1

      Hello,

       

      I have a coldfusion 11 install on a windows server.

       

      I am trying to create a scheduled task with an eventhandler.

       

      Here is the error I am receiving:

       

      • An error occured scheduling the task.
        Invalid eventhandler.
        Error: Eventhandler taskalert could not be found.

       

      The event handler cfc is located here:

      C:\ColdFusion11\cfusion\wwwroot\taskalert.cfc

       

      In the box on the scheduled task I just entered taskalert because I dropped the cfc in the base directory.

       

      The directions say:

      Everything I read shows that the webroot default is C:\ColdFusion11\cfusion\wwwroot

       

      but it doesn't seem to work.

       

      The CFC contains code found here: http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d31851899e53a51353e87049 3-8000.html

       

      but I changed it to my email address

       

      Any ideas what I am missing?

       

      Thanks!

       

      Randy

        • 1. Re: Coldfusion 11 Scheduled Task Event Handler
          RandyCF Level 1

          Anyone have any advice?  Seems like it should be straight forward....

          • 2. Re: Coldfusion 11 Scheduled Task Event Handler
            Pawel Czarnota Level 1

            I am having the same issue and would like to see the answer if someone knows that the issue it. Thanks

            • 3. Re: Coldfusion 11 Scheduled Task Event Handler
              BrandnerTech

              Same issue here - any solution?

              • 4. Re: Coldfusion 11 Scheduled Task Event Handler
                iwfeeym Level 1

                I am having this exact problem. Have you ever found a fix for this?

                 

                In my case, the code, path, everything worked flawlessly on Coldfusion 10 on Windows 7 (32-bt), but when I got a new Windows 7 (64-bit) laptop and installed ColdFusion 11, I get the exact same error you posted. I have googled every single phrase I can think of to find help for this problem. Your post is the only one I found that is even close, and has no answer. It looks as if I will have to abandon the idea of having an eventhandler for my CFSCHEDULE tag.

                • 5. Re: Coldfusion 11 Scheduled Task Event Handler
                  carlos_coa

                  Hi all,

                   

                  We had the same issue and with the help of Adobe support here's what we did to make it work.  First, your event handler (eventlistener.cfc) must be written correctly otherwise you will receive the above error:

                   

                  • An error occured scheduling the task.
                    Invalid eventhandler.
                    Error: Eventhandler taskalert could not be found.

                   

                  The .cfc should follow the template below:

                   

                  <cfcomponent implements="CFIDE.scheduler.ITaskEventHandler">

                      <cffunction name="onTaskStart" returntype="boolean">  <!--- Adobe Change, Here I Changed the returntype to Boolean--->

                          <cfargument name="context" type="struct" >

                          <cfreturn true>

                      </cffunction>

                   

                      <cffunction name="onTaskEnd" access="public" returntype="void">

                          <cfargument name="context" type="struct" required="false"/>

                      </cffunction>

                   

                     <cffunction name="onMisfire" access="public" returntype="void">

                          <cfargument name="context" type="struct" required="false"/>

                      </cffunction>

                   

                      <cffunction name="onError" access="public" returntype="void">

                          <cfargument name="context" type="struct" required="false"/>

                      </cffunction>

                   

                      <cffunction name="execute" access="public" returntype="void">

                          <cfargument name="context" type="struct" >  <!--- Adobe Change,This is the argument which I added--->

                      </cffunction>

                  </cfcomponent>

                   

                  The other important component is to place this eventlistener.cfc in the webroot or in our case we setup a mapping with a logical path to our prefer directory path, so our Event Handler path looked like this:

                   

                  scheduledtasksroot.eventlistener

                   

                  On a side note, another successfully work around was to directly manipulate the neo-cron.xml file found in the /cf11/cfusion/lib folder and restarting the server for it to take effect.  I hope this helps the next person, because we spent a good deal of time dealing with this issue.