Rip's Domain

CF8 Bug – CronService fails with: Element file is undefined in a Java object of type class coldfusion.scheduling.CronTabEntry.

Posted in ColdFusion by rip747 on August 18, 2007

UPDATE: I submitted a bug report to Adobe this evening. 

I’m finding little things since HostMySite.com upgraded their shared servers to CF8. One of the things I’ve come across is that some code that worked in CF7 no longer works in CF8. Take the code below:

<!— call the service factory object —>
<cfobject action=”create” type=”java” class=”coldfusion.server.ServiceFactory” name=”Local.ServiceFactory” />
<!— get all the scheduled tasks that are on the server. —>
<cfset Local.allTasks = Local.ServiceFactory.CronService.listAll()>
<!— loop through the array —>
<cfloop index=”i” from=”1″ to=”#ArrayLen(Local.allTasks)#”>
<!— find our tasks by looking at the tasks name —>
<cfif FindNoCase(“CM_”, Local.allTasks[i].task)>
<!— when we find one, dump the structure —>
<cfdump var=”#Local.allTasks[i]#”>
</cfif>
</cfloop>

It’s real basic and I commented the code so you know what’s going on. Now with CF7 this ran just fine and gave me the tasks structure that I was looking for, with CF8 this fails with the following error:

Element file is undefined in a Java object of type class coldfusion.scheduling.CronTabEntry.

What’s strange is that if I removed the lookup condition, everything works great. See below, same code but I removed the lookup condition:

<!— call the service factory object —>
<cfobject action=”create” type=”java” class=”coldfusion.server.ServiceFactory” name=”Local.ServiceFactory” />
<!— get all the scheduled tasks that are on the server. —>
<cfset Local.allTasks = Local.ServiceFactory.CronService.listAll()>
<!— loop through the array —>
<cfloop index=”i” from=”1″ to=”#ArrayLen(Local.allTasks)#”>
<cfdump var=”#Local.allTasks[i]#”>
</cfloop>

Seems that something is wrong here.

8 Responses

Subscribe to comments with RSS.

  1. Michael Sharman said, on August 19, 2007 at 11:25 pm

    My favourite was this one I got last week:

    java.io.FilePermission C:Coldfusion8wwwrootWEB-INFcftagscomponent.cfc read

    Whoops! Only took 2 days for them to fix😦

  2. Hemant Khandelwal said, on August 20, 2007 at 4:10 am

    Hi,

    I will log a bug and ask someone in the team to verify the issue.

    Thanks,
    Hemant

  3. Hemant Khandelwal said, on August 21, 2007 at 12:06 am

    We could not repro the case here. But I think since this is a related to undocumented (ServiceFactory) usage, we may not investigate this further.

    Thanks,
    Hemant

  4. Kris said, on September 14, 2007 at 5:18 am

    I had a similar problem with CF 8 which was not in CF 7. CF 8 listALL() return newly added schedule task (using the cfschedule tag) as undefined array elements – this was not the case in cf7. A solution to this is to all the load() method before the listALL.

    Try this

  5. Kris said, on September 14, 2007 at 5:19 am

  6. MikeC said, on August 7, 2008 at 12:11 pm

    factory = createObject(“java”, “coldfusion.server.ServiceFactory”);
    cron = factory.getCronService();
    alltasks = cron.listAll();

  7. Mike Causer said, on January 13, 2009 at 11:26 pm

    cron.listAll() – returns an array of all task structs
    cron.list() – a string of all tasks structs
    cron.findTask(taskName) – a single task struct or java undefined

    // if you have lots of tasks, you can check for the existence of a single task like so:
    loc.cron = createObject( ‘java’, ‘coldfusion.server.ServiceFactory’ ).getCronService();

    loc.task = loc.cron.findTask(‘taskname’);
    if ( structKeyExists( loc, ‘task’ ) )
    loc.taskFound = true;
    else
    loc.taskFound = false;

    // loc.task is a structure representing the task
    // or a java undefined value

  8. adam j. sontag said, on July 10, 2009 at 2:19 am

    Worth noting that manipulating the structure representing the task actually updates the task on the server…hack away…

    –adam


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: