Skip to content

Class geocoder does not exist #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
foziazahoor opened this issue Aug 3, 2017 · 12 comments
Closed

Class geocoder does not exist #94

foziazahoor opened this issue Aug 3, 2017 · 12 comments

Comments

@foziazahoor
Copy link

foziazahoor commented Aug 3, 2017

Getting "Class geocoder does not exist"

use Geocoder\Laravel\Facades\Geocoder;
app('geocoder')->geocode('Los Angeles, CA')->get();

toin0u/geocoder-laravel 1.1.2 Geocoder Service Provider for Laravel
Added Geocoder\Laravel\Providers\GeocoderService::class, in app.php in providers array
Laravel Version : 5.4

error

@mikebronner
Copy link
Member

Remove this line:
use Geocoder\Laravel\Facades\Geocoder;

Can you copy/paste the stacktrace from your laravel log file as well, please?

@foziazahoor
Copy link
Author

foziazahoor commented Aug 3, 2017

Removed this line:
use Geocoder\Laravel\Facades\Geocoder;

[2017-08-03 22:18:33] local.ERROR: exception 'ReflectionException' with message 'Class geocoder does not exist' in /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Container/Container.php:729
Stack trace:
#0 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Container/Container.php(729): ReflectionClass->__construct('geocoder')
#1 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('geocoder')
#2 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('geocoder')
#3 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('geocoder')
#4 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(106): Illuminate\Foundation\Application->make('geocoder')
#5 /var/www/html/addressbook/app/Http/Controllers/AddressController.php(30): app('geocoder')
#6 [internal function]: App\Http\Controllers\AddressController->index()
#7 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(55): call_user_func_array(Array, Array)
#8 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(44): Illuminate\Routing\Controller->callAction('index', Array)
#9 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Route.php(204): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\AddressController), 'index')
#10 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): Illuminate\Routing\Route->runController()
#11 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Router.php(574): Illuminate\Routing\Route->run()
#12 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#13 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#14 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#15 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#16 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#17 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#18 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#19 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(65): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#20 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#21 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#22 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#23 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#24 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#25 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#26 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#28 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#29 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#31 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#32 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#34 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#35 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Router.php(576): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#36 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Router.php(535): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#37 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Router.php(513): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#38 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#39 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#40 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#41 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#42 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#43 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#44 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#45 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#46 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#47 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#48 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#49 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#50 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#52 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#53 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#54 /var/www/html/addressbook/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#55 /var/www/html/addressbook/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#56 {main}

@mikebronner
Copy link
Member

Did you upgrade from a previous version? Be sure to remove the alias you may have registered in you \config\app.php file.

@foziazahoor
Copy link
Author

foziazahoor commented Aug 3, 2017

No! I didn't upgrade... i've installed it few hours ago... there is only one entry in config/app.php in providers array:
Geocoder\Laravel\Providers\GeocoderService::class
http://i.prntscr.com/wyvVcbqrRTusvbQv64gZlg.png

I've executed following command:
php artisan vendor:publish --provider="Geocoder\Laravel\Providers\GeocoderService" --tag="config"

but it didn't work so I manually copy/paste geocoder.php in my config folder... and nothing else...

i've also tried removing that copied file... but didn't work...

removed cache also...

my php version:
PHP 5.6.31-1~ubuntu14.04.1+deb.sury.org+1 (cli)

@foziazahoor
Copy link
Author

I've completely removed toin0u from vendors directory then run composer update then i get following output:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing toin0u/geocoder-laravel (1.1.2): Loading from cache
Package egeloen/http-adapter is abandoned, you should avoid using it. Use php-http/httplug instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
The compiled services file has been removed.

@mikebronner
Copy link
Member

mikebronner commented Aug 3, 2017

That's expected output.

@foziazahoor
Copy link
Author

No! same Class geocoder does not exist error

@mikebronner
Copy link
Member

mikebronner commented Aug 3, 2017

Ignore my previous comment about php7. I got it confused with the upcoming release.

@mikebronner
Copy link
Member

Try removing the geocoder config file, if you published it.

@mikebronner
Copy link
Member

Hi @foziazahoor ... have you been able to solve this? This is most likely a configuration issue on your end, as we have not received any other reports like this, and I am unable to replicate it.

@foziazahoor
Copy link
Author

Hi, yup there is something wrong at my end... because it is working fine on my windows on php 7.0.9... i've upgraded to php 7.1 on my ubuntu as well... but still not working...

@mikebronner
Copy link
Member

Bugger ... maybe start a new project and try it there? You can always run the unit tests to see if they work. They use their own configuration. If you're running on Ubuntu 14.x it might be an OpenSSL security issue, preventing the HTTPS requests from completing. Push your project to a production server on Ubuntu 16 (I use Laravel Forge), and it might work there. I've seen the old versions (prior to last week's 4.0 release) not work on local environments because of the OoenSSL issue, but work fine in production. Give that a shot.

I will close this for now, but feel free to open a new ticket if you find an issue in the end (maybe a conflict with another package, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants