Laravel queue worker can't process jobs # 错误日志 local.ERROR: Class does not exist "exception&quo

Posted

技术标签:

【中文标题】Laravel queue worker can\'t process jobs # 错误日志 local.ERROR: Class does not exist "exception":"[object] (ReflectionException(code【英文标题】:Laravel queue worker can't process jobs # Error log local.ERROR: Class does not exist "exception":"[object] (ReflectionException(codeLaravel queue worker can't process jobs # 错误日志 local.ERROR: Class does not exist "exception":"[object] (ReflectionException(code 【发布时间】:2020-10-03 23:44:52 【问题描述】:

我正在尝试使用 Laravel 5.6 作业队列来避免我的项目中的电子邮件发送延迟及其不工作 .

我的日志文件包含以下错误

[2020-06-14 12:46:03] local.ERROR: Class does not exist "exception":"[object] (ReflectionException(code: -1): Class does not exist at /var/www /html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:767) [堆栈跟踪]

#0 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(767): ReflectionClass->__construct('')

#1 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(646): Illuminate\Container\Container->build(NULL)

#2 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(601): Illuminate\Container\Container->resolve(NULL, Array)

#3 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(734): Illuminate\Container\Container->make(NULL, Array)

#4 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(184): Illuminate\Foundation\Application->make(NULL)

#5 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(83): Illuminate\Queue\Jobs\Job->resolve(NULL)

#6 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(326): Illuminate\Queue\Jobs\Job->fire()

#7 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(276): Illuminate\Queue\Worker->process('database', Object(Illuminate\ Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))

#8 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\ DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))

#9 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default ', 对象(Illuminate\Queue\WorkerOptions))

#10 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', '默认')

#11【内部函数】:Illuminate\Queue\Console\WorkCommand->handle()

#12 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)

#13 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\closure()

#14 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application) , 数组, 对象(闭包))

#15 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application) , 数组, 数组, NULL)

#16 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(179): Illuminate\Container\Container->call(Array)

#17 /var/www/html/project/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput) , 对象(照明\控制台\输出样式))

#18 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\ Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

#19 /var/www/html/project/vendor/symfony/console/Application.php(1000): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object (Symfony\Component\Console\Output\ConsoleOutput))

#20 /var/www/html/project/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object (Symfony\Component\Console\Input\ArgvInput),对象(Symfony\Component\Console\Output\ConsoleOutput))

#21 /var/www/html/project/vendor/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput) , 对象(Symfony\Component\Console\Output\ConsoleOutput))

#22 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Console/Application.php(89): Symfony\Component\Console\Application->运行(对象(Symfony\Component\Console\Input\ArgvInput),对象(Symfony\Component\Console\Output\ConsoleOutput))

#23 /var/www/html/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\ Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

#24 /var/www/html/project/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console \输出\控制台输出))

#25 主

【问题讨论】:

这篇文章很难阅读和理解 电子邮件工作不工作这是实际问题.. 长代码是错误日志.. 我认为它对某人有用 错误是好的,但它并没有让我们看到实际上正在尝试解决哪个类,也许队列作业本身在有效负载中有错误的数据,但如果没有更多信息就不能说 坏数据负载意味着什么?你能澄清一下吗? (所有其他配置都很好,例如 env mail 等,因为相同的配置在另一个项目中工作) 【参考方案1】:

类不存在 "exception":"[object] (ReflectionException(code: -1): 类在 vendor/laravel/framework/src/Illuminate/Container/Container.php:767 中不存在) [堆栈跟踪]

反射异常是由于 php 和 laravel 的版本冲突而发生的,有关反射异常的更多信息,请参阅 link 。

我已更改我的 php 版本并运行 composer update 。现在它正在工作

【讨论】:

以上是关于Laravel queue worker can't process jobs # 错误日志 local.ERROR: Class does not exist "exception&quo的主要内容,如果未能解决你的问题,请参考以下文章

为 Amazon Beanstalk 上的 Laravel Queue Worker 提供环境变量

Laravel Queue Worker、RabbitMQ 和远程生成的运行作业

Laravel - 在一台服务器上发送作业,在另一台服务器上处理

使用 Supervisor 配置 Laravel 运行队列处理器

使用 Supervisor 配置 Laravel 运行队列处理器

Keras fit_generator中的max_queue_size, workers, use_multiprocessing设置