Laravel-excel: [QUESTION] No handler registered for command [Maatwebsite\Excel\Readers\ChunkedReadJob]

Created on 5 Oct 2016  路  10Comments  路  Source: Maatwebsite/Laravel-Excel

Please prefix your issue with one of the following: [BUG] [PROPOSAL] [QUESTION].

Package version, Laravel version

2.1.0, 5.2

Expected behaviour

do the stuff

Actual behaviour

error

Exception stack trace

Exception trace:
() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:348
CollectiveBusDispatcher->inflectSegment() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:311
CollectiveBusDispatcher->getHandlerClass() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:295
CollectiveBusDispatcher->resolveHandler() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:203
CollectiveBusDispatcher->CollectiveBus{closure}() at n/a:n/a
call_user_func() at /var/www/project/public_html/bootstrap/cache/compiled.php:9970
IlluminatePipelinePipeline->IlluminatePipeline{closure}() at n/a:n/a
call_user_func() at /var/www/project/public_html/bootstrap/cache/compiled.php:9948
IlluminatePipelinePipeline->then() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:212
CollectiveBusDispatcher->dispatchNow() at /var/www/project/public_html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:41
IlluminateQueueCallQueuedHandler->call() at /var/www/project/public_html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:130
IlluminateQueueJobsJob->resolveAndFire() at /var/www/project/public_html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php:44
IlluminateQueueJobsSyncJob->fire() at /var/www/project/public_html/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php:30
IlluminateQueueSyncQueue->push() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:279
CollectiveBusDispatcher->pushCommandToQueue() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:253
CollectiveBusDispatcher->dispatchToQueue() at /var/www/project/public_html/vendor/laravelcollective/bus/src/Dispatcher.php:182
CollectiveBusDispatcher->dispatch() at /var/www/project/public_html/vendor/maatwebsite/excel/src/Maatwebsite/Excel/Readers/LaravelExcelReader.php:577
MaatwebsiteExcelReadersLaravelExcelReader->chunk() at /var/www/project/public_html/app/Console/Commands/ImportAreas.php:99
NamespaceConsoleCommandsImportAreas->handle() at n/a:n/a
call_user_func_array() at /var/www/project/public_html/bootstrap/cache/compiled.php:1257
IlluminateContainerContainer->call() at /var/www/project/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
IlluminateConsoleCommand->execute() at /var/www/project/public_html/vendor/symfony/console/Command/Command.php:256
SymfonyComponentConsoleCommandCommand->run() at /var/www/project/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
IlluminateConsoleCommand->run() at /var/www/project/public_html/vendor/symfony/console/Application.php:794
SymfonyComponentConsoleApplication->doRunCommand() at /var/www/project/public_html/vendor/symfony/console/Application.php:186
SymfonyComponentConsoleApplication->doRun() at /var/www/project/public_html/vendor/symfony/console/Application.php:117
SymfonyComponentConsoleApplication->run() at /var/www/project/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
IlluminateFoundationConsoleKernel->handle() at /var/www/project/public_html/artisan:35

Screenshot of Excel file

image

Steps to reproduce the behaviour

Excel::filter('chunk')->load(database_path('csv/areas/'.$file))->chunk(500,
function($results) {

I have this in a console controlle that used to work before doind a composer update recently. No package version was updated to a new version, I have everything in place (aliases and classes), I don't understand why this is happening now, I haven't changed the code for this part.

Thanks.

Most helpful comment

@ashutoshpandey - I was able to fix this in my code by adding SelfHandling contract to the ChunkedReadJob class.

The beginning of the file ChunkedReadJob.php should be changed as illustrated below:

<?php

namespace Maatwebsite\Excel\Readers;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Maatwebsite\Excel\Filters\ChunkReadFilter;
use SuperClosure\Serializer;

class ChunkedReadJob implements ShouldQueue, SelfHandling
{

All 10 comments

Try removing the laravelcollective/bus package so it will use the default Laravel queing bus.

There is no laravelcollective/bus package in my project, I'm still having this problem. Please suggest, thanks

@ashutoshpandey - I was able to fix this in my code by adding SelfHandling contract to the ChunkedReadJob class.

The beginning of the file ChunkedReadJob.php should be changed as illustrated below:

<?php

namespace Maatwebsite\Excel\Readers;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Maatwebsite\Excel\Filters\ChunkReadFilter;
use SuperClosure\Serializer;

class ChunkedReadJob implements ShouldQueue, SelfHandling
{

If you use the default Laravel Bus Dispatcher, it's self handling by default.

@robmagento I got the same issue like you. @kaysersoze solution work for my.

I'm getting the same issue, but is there a fix that doesn't involve editing files outside of source control? I am including this with composer, so I'd rather not edit ChunkedReadJob like @kaysersoze suggested

@ivan-grozni Probably the "best" way to handle that, is to fork this repository, make your changes, and use that fork in composer as described here: https://stackoverflow.com/a/13500676

@kaysersoze Thank you!

@kaysersoze bless you !! thank you !!

had the same issue, i found out that the queue name being used was pointed to another application in supervisor config.

Was this page helpful?
0 / 5 - 0 ratings