No entry is registered for key 'job_dispatcher'

519 views
Skip to first unread message

Jim Safley

unread,
Jul 21, 2011, 12:30:57 PM7/21/11
to Omeka Dev
When loading Omeka up to the initializePlugins phase, and attempting
to assign a Filesystem file to an item using insert_item(), I get the
following fatal error:

PHP Fatal error: Uncaught exception 'Zend_Exception' with message 'No
entry is registered for key 'job_dispatcher'' in /omeka/application/
libraries/Zend/Registry.php:147
Stack trace:
#0 /omeka/application/models/File.php(67):
Zend_Registry::get('job_dispatcher')
#1 [internal function]: File->afterInsert()
#2 /omeka/application/libraries/Omeka/Record.php(284):
call_user_func_array(Array, Array)
#3 /omeka/application/libraries/Omeka/Record.php(563): Omeka_Record-
>runCallbacks('afterInsert')
#4 /omeka/application/libraries/Omeka/Record.php(583): Omeka_Record-
>save()
#5/omeka/application/models/Item.php(288): Omeka_Record->forceSave()
#6 /omeka/application/models/Item.php(223): Item->saveFiles()
#7 [internal function]: Item->afterSave()
#8 /omeka/application/libraries/Omeka/Record.php( in /omeka/
application/libraries/Zend/Registry.php on line 147

I assume this is because job_dispatcher is set in a later phase, but I
can't find which one. I do, however, see that the Jobs resource
depends on the CurrentUser resource, which is problematic for me since
I don't want to load Acl, Auth, or CurrentUser for reasons explained
in a previous post. [1]

Could someone shed some light why this error occurs? Am I close?

Thanks,
Jim

[1] http://groups.google.com/group/omeka-dev/browse_thread/thread/3588828fba3ba205

Kris Kelly

unread,
Jul 21, 2011, 1:21:03 PM7/21/11
to omek...@googlegroups.com
The job dispatcher is registered in the Jobs resource. Unfortunately, the "phased loading" feature is fragile and doesn't really play nice with dependencies among resources. You should just bootstrap directly the resources that your script needs. See application/core/beanstalk-worker.php for inspiration.

Allow me to explain:

The old phased loading feature was a simple sequence, e.g. phasedLoad(C) --> "load A, then load B, then load C". This pays no attention to dependencies between the resources. If for instance, C depends on D, then phasedLoad(C) would just die. The only way to fix it was to rearrange the resources so that the order would be A,B,D,C. You can see how this is fragile, especially if the order needed to be rearranged in the future.

Zend_Application takes a different approach, where the resources are represented by a dependency graph. Something more along the lines of the following:

A
/ \
B C
\
D

So using that approach, calling bootstrap(A) would load B, C and D automatically. Much cleaner approach that doesn't involve trying to figure out which needs to be loaded first.

That said, which "phase" are you trying to load? Try bootstrapping just the resources that your script needs, and we can diagnose any problems from there.

Thanks,
Kris

> --
> You received this message because you are subscribed to the Google Groups "Omeka Dev" group.
> To post to this group, send email to omek...@googlegroups.com.
> To unsubscribe from this group, send email to omeka-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/omeka-dev?hl=en.
>

Jim Safley

unread,
Jul 21, 2011, 3:24:31 PM7/21/11
to Omeka Dev
Thanks Kris! I just bootstrapped the requisite resources (Jobs,
Storage) as you instructed and everything works fine.

Jim
> > [1]http://groups.google.com/group/omeka-dev/browse_thread/thread/3588828...
Reply all
Reply to author
Forward
0 new messages