duanquannan0593 2016-03-23 21:39
浏览 26

Symfony2 Mmoreram GearmanClient无法加载

I'm facing some problems with the GearmanBundle, since after the process of installation succeeded, I can find all my jobs and workers:

$ app/console gearman:worker:list

@Worker:

HeloBundle\Workers\PushWorker

callablename: HeloBundleWorkersPushWorker

Jobs:

  • 1

    name: sendPushJob

    callablename: HeloBundleWorkersPushWorker~sendPushJob

@Worker: HeloBundle\Workers\EmailWorker

callablename: HeloBundleWorkersEmailWorker

Jobs:

  • 2

    name: sendMailJob

    callablename: HeloBundleWorkersEmailWorker~sendMailJob

As you can se, my gearman is installed on php:

$ php -i | grep gearman | grep enabled

gearman support => enabled

But when I call this:

try
 {
                $gearman = $this->container->get('gearman');
                $gearman->doBackgroundJob('HeloBundleWorkersPushWorker~sendPushJob', json_encode(array(
                        'tags' => $tags,
                        'message' => $message,
                        'all' => $all
                    )));
                $flash['type'] = 'notice';
                $flash['message'] = 'Success.';
            } catch (\Exception $e) {
                $flash['type'] = 'warning';
                $flash['message'] = 'Error.';
            }

It returns me this message:

request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "GearmanClient" from the global namespace. Did you forget a "use" statement for "Mmoreram\GearmanBundle\Service\GearmanClient"?" at /var/www/stage/vendor/mmoreram/gearman-bundle/Mmoreram/GearmanBundle/Service/GearmanClient.php line 90 {"exception":"[object] (Symfony\Component\Debug\Exception\ClassNotFoundException(code: 0): Attempted to load class \"GearmanClient\" from the global namespace. Did you forget a \"use\" statement for \"Mmoreram\GearmanBundle\Service\GearmanClient\"? at /var/www/stage/vendor/mmoreram/gearman-bundle/Mmoreram/GearmanBundle/Service/GearmanClient.php:90)"} []

The bundle can't load the native GearmanClient() on global scope. Can you help me with this ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算