rydurham / Sentinel

A Sentry bridge package for Laravel
http://www.ryandurham.com/projects/sentinel/
317 stars 68 forks source link

local.ERROR: exception 'ReflectionException' with message 'Class cache does not exist' in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container #231

Closed narbehmovsesi closed 6 years ago

narbehmovsesi commented 7 years ago

I have been able to successfully install this package on my dev server however when I push my code to the production server I get the following error. local.ERROR: exception 'ReflectionException' with message 'Class cache does not exist' in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.

I am using memcached in the production server but i am not sure if that is what the problem is. Any help would be appreciated.

rydurham commented 7 years ago

That is a tricky problem. Are you able to use the caching classes elsewhere in your code? There could be a couple different things happening here. Is your production server environment any different from your local dev environment?

narbehmovsesi commented 7 years ago

Yes, the dev server is all Laravel default but the production we use Memcached.

narbehmovsesi commented 7 years ago

Dev Server

CACHE_DRIVER=file

SESSION_DRIVER=file

QUEUE_DRIVER=sync

Production

CACHE_DRIVER=memcached SESSION_DRIVER=memcached QUEUE_DRIVER=sync

grep memcache /etc/php.ini

session.save_handler = memcached

This is all that is different in my Dev and Prod Server

rydurham commented 7 years ago

Is the memcached pecl package installed on that server?

narbehmovsesi commented 7 years ago

Yes. [root@ip-172-16-60-220 ~]# rpm -qa | grep cache php56-pecl-memcached-2.2.0-5.16.amzn1.x86_64 libmemcached-1.0.16-5.8.amzn1.x86_64

rydurham commented 7 years ago

I may not be able to help, unfortunately. You could try stepping through the stack trace to see where the error was being triggered within the request. If the problem really is with the Illuminate container class you may need to try reaching out on laravel.io or the laracasts forum.

narbehmovsesi commented 7 years ago

2017-05-03 19:29:48 [stderr][2017-05-03 19:29:48] local.ERROR: exception 'ReflectionException' with message 'Class cache does not exist' in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:779 2017-05-03 19:29:48 [stderr]Stack trace: 2017-05-03 19:29:48 [stderr]#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(779): ReflectionClass->construct('cache') 2017-05-03 19:29:48 [stderr]#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(659): Illuminate\Container\Container->build('cache', Array) 2017-05-03 19:29:48 [stderr]#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(644): Illuminate\Container\Container->make('cache', Array) 2017-05-03 19:29:48 [stderr]#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1234): Illuminate\Foundation\Application->make('cache') 2017-05-03 19:29:48 [stderr]#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php(154): Illuminate\Container\Container->offsetGet('cache') 2017-05-03 19:29:48 [stderr]#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php(141): Illuminate\Session\SessionManager->createCacheHandler('memcached') 2017-05-03 19:29:48 [stderr]#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php(106): Illuminate\Session\SessionManager->createCacheBased('memcached') 2017-05-03 19:29:48 [stderr]#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Manager.php(89): Illuminate\Session\SessionManager->createMemcachedDriver() 2017-05-03 19:29:48 [stderr]#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Manager.php(62): Illuminate\Support\Manager->createDriver('memcached') 2017-05-03 19:29:48 [stderr]#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php(48): Illuminate\Support\Manager->driver() 2017-05-03 19:29:48 [stderr]#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Session\SessionServiceProvider->Illuminate\Session{closure}(Object(Illuminate\Foundation\Application), Array) 2017-05-03 19:29:48 [stderr]#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(659): Illuminate\Container\Container->build(Object(Closure), Array) 2017-05-03 19:29:48 [stderr]#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(644): Illuminate\Container\Container->make('session.store', Array) 2017-05-03 19:29:48 [stderr]#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1234): Illuminate\Foundation\Application->make('session.store') 2017-05-03 19:29:48 [stderr]#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(104): Illuminate\Container\Container->offsetGet('session.store') 2017-05-03 19:29:48 [stderr]#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(290): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing{closure}(Object(Illuminate\Foundation\Application)) 2017-05-03 19:29:48 [stderr]#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Container\Container->Illuminate\Container{closure}(Object(Illuminate\Foundation\Application), Array) 2017-05-03 19:29:48 [stderr]#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(659): Illuminate\Container\Container->build(Object(Closure), Array) 2017-05-03 19:29:48 [stderr]#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(644): Illuminate\Container\Container->make('redirect', Array) 2017-05-03 19:29:48 [stderr]#19 /var/www/html/vendor/rydurham/sentinel/src/Sentinel/SentryServiceProvider.php(50): Illuminate\Foundation\Application->make('redirect') 2017-05-03 19:29:48 [stderr]#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(541): Sentinel\SentryServiceProvider->construct(Object(Illuminate\Foundation\Application)) 2017-05-03 19:29:48 [stderr]#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(491): Illuminate\Foundation\Application->resolveProviderClass('Sentinel\Sentry...') 2017-05-03 19:29:48 [stderr]#22 /var/www/html/vendor/rydurham/sentinel/src/Sentinel/SentinelServiceProvider.php(75): Illuminate\Foundation\Application->register('Sentinel\Sentry...') 2017-05-03 19:29:48 [stderr]#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(494): Sentinel\SentinelServiceProvider->register() 2017-05-03 19:29:48 [stderr]#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\Foundation\Application->register(Object(Sentinel\SentinelServiceProvider)) 2017-05-03 19:29:48 [stderr]#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(468): Illuminate\Foundation\ProviderRepository->load(Array) 2017-05-03 19:29:48 [stderr]#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(15): Illuminate\Foundation\Application->registerConfiguredProviders() 2017-05-03 19:29:48 [stderr]#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(183): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application)) 2017-05-03 19:29:48 [stderr]#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(195): Illuminate\Foundation\Application->bootstrapWith(Array) 2017-05-03 19:29:48 [stderr]#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(92): Illuminate\Foundation\Console\Kernel->bootstrap() 2017-05-03 19:29:48 [stderr]#30 /var/www/html/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 2017-05-03 19:29:48 [stderr]#31 {main} 2017-05-03 19:29:48 [stderr] 2017-05-03 19:29:48 [stdout] 2017-05-03 19:29:48 [stdout] 2017-05-03 19:29:48 [stdout] 2017-05-03 19:29:48 [stdout] [ReflectionException] 2017-05-03 19:29:48 [stdout] Class cache does not exist 2017-05-03 19:29:48 [stdout] 2017-05-03 19:29:48 [stdout] 2017-05-03 19:29:48 [stdout] 2017-05-03 19:29:48 [stderr]Script php artisan clear-compiled handling the post-install-cmd event returned with error code 1

rydurham commented 7 years ago

Are you able to run app()->make('cache'); on that server? (You can try it using the tinker tool.)

narbehmovsesi commented 7 years ago

it doesn't even build when I push the code to production. I don't have access to the productions server via terminal

rydurham commented 7 years ago

My guess is that there is some sort of cache configuration problem on that server. If you have access to a different server you could try a test deployment there to see if it works. Beyond that, I am out of ideas.

narbehmovsesi commented 7 years ago

ok thank you very much

swilla commented 6 years ago

I'm having this issue as well. I was able to trace it down to the following line in the SentrySeviceProvider: https://github.com/rydurham/Sentinel/blob/master/src/Sentinel/SentryServiceProvider.php#L53

$this->redirect = $this->app->make('redirect');

If I comment out that line it works without any problems. The package seems to work fine, although I don't really know what that line is actually doing for the package.

I do not get that error with file session storage, only redis or memcached. I think it has something to do with the order of how things are resolved.

rydurham commented 6 years ago

It looks like that is left over from an earlier version of the package. I will remove that constructor in the next release.

rydurham commented 6 years ago

This should (hopefully) now be fixed in version 2.8.1.