Cannot instantiate interface Lcobucci\\JWT\\Parser in laravel 9 - laravel-9

{
"message": "Cannot instantiate interface Lcobucci\JWT\Parser",
"exception": "Error",
"file": "/var/www/app/Http/Middleware/Authenticate.php",
"line": 95,
"trace": [
{
"file": "/var/www/app/Http/Middleware/Authenticate.php",
"line": 54,
"function": "validateToken",
"class": "App\Http\Middleware\Authenticate",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 180,
"function": "handle",
"class": "App\Http\Middleware\Authenticate",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 116,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 726,
"function": "then",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 703,
"function": "runRouteWithinStack",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 667,
"function": "runRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 656,
"function": "dispatchToRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 167,
"function": "dispatch",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 141,
"function": "Illuminate\Foundation\Http\{closure}",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
"line": 31,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 180,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
"line": 40,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 180,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TrimStrings",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 180,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
"line": 86,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 180,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php",
"line": 62,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 180,
"function": "handle",
"class": "Illuminate\Http\Middleware\HandleCors",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php",
"line": 39,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 180,
"function": "handle",
"class": "Illuminate\Http\Middleware\TrustProxies",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 116,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 142,
"function": "then",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 111,
"function": "sendRequestThroughRouter",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/var/www/public/index.php",
"line": 52,
"function": "handle",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
}
]
}

use Lcobucci\JWT\Parser as JwtParser;
$token = app(Parser::class)->parse($token)->claims()->get('jti');

Related

Authorize failed when Click Authorize at react-native-twitter-signin

I got an error every 1 per 10 time when trying to authorize person via Twitter. The error in console says: Error: Authorize failed. Whereas the user clicks on the Authorize button.
I also got the same error when user clicks cancel in authorize screen. I don't know why I am getting this.
This is only happening on the real device at Android.
This is a screenshot of that error in android: https://aws1.discourse-cdn.com/twitter/original/3X/d/7/d7a7696403d3e612098d64e48e7cfa2a73ca215e.jpeg
As you can see at the screenshot, there is an android main system error. This error in Turkish right now because of my phone language but in english it says: ‘Action can not completed.’
This is a complete error log.
{
"nativeStackAndroid": [
{
"lineNumber": 98,
"file": "AuthHandler.java",
"methodName": "handleOnActivityResult",
"class": "com.twitter.sdk.android.core.identity.AuthHandler"
},
{
"lineNumber": 171,
"file": "TwitterAuthClient.java",
"methodName": "onActivityResult",
"class": "com.twitter.sdk.android.core.identity.TwitterAuthClient"
},
{
"lineNumber": 121,
"file": "TwitterSigninModule.java",
"methodName": "onActivityResult",
"class": "com.goldenowl.twittersignin.TwitterSigninModule"
},
{
"lineNumber": 333,
"file": "ReactContext.java",
"methodName": "onActivityResult",
"class": "com.facebook.react.bridge.ReactContext"
},
{
"lineNumber": 785,
"file": "ReactInstanceManager.java",
"methodName": "onActivityResult",
"class": "com.facebook.react.ReactInstanceManager"
},
{
"lineNumber": 90,
"file": "ReactDelegate.java",
"methodName": "onActivityResult",
"class": "com.facebook.react.ReactDelegate"
},
{
"lineNumber": 113,
"file": "ReactActivityDelegate.java",
"methodName": "onActivityResult",
"class": "com.facebook.react.ReactActivityDelegate"
},
{
"lineNumber": 70,
"file": "ReactActivity.java",
"methodName": "onActivityResult",
"class": "com.facebook.react.ReactActivity"
},
{
"lineNumber": 7762,
"file": "Activity.java",
"methodName": "dispatchActivityResult",
"class": "android.app.Activity"
},
{
"lineNumber": 4603,
"file": "ActivityThread.java",
"methodName": "deliverResults",
"class": "android.app.ActivityThread"
},
{
"lineNumber": 4652,
"file": "ActivityThread.java",
"methodName": "handleSendResult",
"class": "android.app.ActivityThread"
},
{
"lineNumber": 49,
"file": "ActivityResultItem.java",
"methodName": "execute",
"class": "android.app.servertransaction.ActivityResultItem"
},
{
"lineNumber": 108,
"file": "TransactionExecutor.java",
"methodName": "executeCallbacks",
"class": "android.app.servertransaction.TransactionExecutor"
},
{
"lineNumber": 68,
"file": "TransactionExecutor.java",
"methodName": "execute",
"class": "android.app.servertransaction.TransactionExecutor"
},
{
"lineNumber": 1948,
"file": "ActivityThread.java",
"methodName": "handleMessage",
"class": "android.app.ActivityThread$H"
},
{
"lineNumber": 106,
"file": "Handler.java",
"methodName": "dispatchMessage",
"class": "android.os.Handler"
},
{
"lineNumber": 214,
"file": "Looper.java",
"methodName": "loop",
"class": "android.os.Looper"
},
{
"lineNumber": 7050,
"file": "ActivityThread.java",
"methodName": "main",
"class": "android.app.ActivityThread"
},
{
"lineNumber": -2,
"file": "Method.java",
"methodName": "invoke",
"class": "java.lang.reflect.Method"
},
{
"lineNumber": 494,
"file": "RuntimeInit.java",
"methodName": "run",
"class": "com.android.internal.os.RuntimeInit$MethodAndArgsCaller"
},
{
"lineNumber": 965,
"file": "ZygoteInit.java",
"methodName": "main",
"class": "com.android.internal.os.ZygoteInit"
}
],
"userInfo": null,
"message": "Authorize failed.",
"code": "USER_CANCELLED",
"line": 50,
"column": 1119,
"sourceURL": "index.android.bundle"
}

Symfony 4.4 FOS user-bundle api/auth/login Call to a member function findOneBy() on null

I'm using symfony 4.4 via docker and installed FOS user bundle some time ago. Everything was working fine but recently while trying to login, i keep getting the error
Call to a member function findOneBy() on null.
The full trace is this
{
"meta": {
"code": 0,
"message": "Call to a member function findOneBy() on null",
"file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php",
"line": 76,
"trace": [
{
"file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Model/UserManager.php",
"line": 58,
"function": "findUserBy"
},
{
"file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Security/UserProvider.php",
"line": 93,
"function": "findUserByUsername"
},
{
"file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Security/UserProvider.php",
"line": 43,
"function": "findUser"
},
{
"file": "/var/www/symfony/vendor/symfony/security-core/User/ChainUserProvider.php",
"line": 56,
"function": "loadUserByUsername"
},
{
"file": "/var/www/symfony/vendor/symfony/security-core/Authentication/Provider/DaoAuthenticationProvider.php",
"line": 85,
"function": "loadUserByUsername"
},
{
"file": "/var/www/symfony/vendor/symfony/security-core/Authentication/Provider/UserAuthenticationProvider.php",
"line": 65,
"function": "retrieveUser"
},
{
"file": "/var/www/symfony/vendor/symfony/security-core/Authentication/AuthenticationProviderManager.php",
"line": 85,
"function": "authenticate"
},
{
"file": "/var/www/symfony/vendor/symfony/security-http/Firewall/UsernamePasswordJsonAuthenticationListener.php",
"line": 137,
"function": "authenticate"
},
{
"file": "/var/www/symfony/vendor/symfony/security-bundle/Debug/WrappedLazyListener.php",
"line": 49,
"function": "authenticate"
},
{
"file": "/var/www/symfony/vendor/symfony/security-http/Firewall/AbstractListener.php",
"line": 27,
"function": "authenticate"
},
{
"file": "/var/www/symfony/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php",
"line": 62,
"function": "__invoke"
},
{
"file": "/var/www/symfony/vendor/symfony/security-http/Firewall.php",
"line": 98,
"function": "callListeners"
},
{
"file": "/var/www/symfony/vendor/symfony/event-dispatcher/Debug/WrappedListener.php",
"line": 126,
"function": "onKernelRequest"
},
{
"file": "/var/www/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 264,
"function": "__invoke"
},
{
"file": "/var/www/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 239,
"function": "doDispatch"
},
{
"file": "/var/www/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 73,
"function": "callListeners"
},
{
"file": "/var/www/symfony/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php",
"line": 168,
"function": "dispatch"
},
{
"file": "/var/www/symfony/vendor/symfony/http-kernel/HttpKernel.php",
"line": 134,
"function": "dispatch"
},
{
"file": "/var/www/symfony/vendor/symfony/http-kernel/HttpKernel.php",
"line": 80,
"function": "handleRaw"
},
{
"file": "/var/www/symfony/vendor/symfony/http-kernel/Kernel.php",
"line": 201,
"function": "handle"
},
{
"file": "/var/www/symfony/public/index.php",
"line": 25,
"function": "handle"
}
]
},
"links": {
"self": "/api/auth/login"
},
"errors": [
{
"status": "500",
"code": "INTERNAL_SERVER_ERROR",
"title": "Internal Server Error"
}
]
}
The register endpoint works pretty good at url api/auth/register and registers the new user.
Any ideas?
Finally i could solve the issue by permanently deleting the vendor folder and using composer install to install all packages again.
Composer update didn't help at all.
I'm still not sure what was the issue but the solution for this problem was that.

Sqoop2 Rest API Link Creation

I need your help!
3 days i can't create link by Sqoop Rest API.
Sqoop2 Server installed on the Hadoop cluster of claudera
I send post request with body:
{
"link" : {
"id" : -1,
"enabled" : true,
"update-date" : 1415287846371,
"creation-date" : 1415287846371,
"update-user" : "user",
"creation-user" : "user",
"name" : "JDBCtest_table",
"connector-id" : 4,
"link-config-values" : [{
"id" : 9,
"inputs" : [{
"id" : 18,
"overrides" : "",
"name" : "linkConfig.jdbcDriver",
"value" : "com.postgresql.jdbc.Driver",
"type" : "STRING",
"size" : 128,
"sensitive" : false
}, {
"id" : 19,
"overrides" : "",
"name" : "linkConfig.connectionString",
"value" : "jdbc:postgresql:\/\/11.11.111.1111:5432\/database",
"type" : "STRING",
"size" : 128,
"sensitive" : false
}, {
"id" : 20,
"overrides" : "",
"name" : "linkConfig.username",
"value" : "username",
"type" : "STRING",
"size" : 40,
"sensitive" : false
}, {
"id" : 21,
"overrides" : "",
"name" : "linkConfig.password",
"value" : "pass",
"type" : "STRING",
"size" : 40,
"sensitive" : false
}, {
"id" : 22,
"overrides" : "",
"name" : "linkConfig.jdbcProperties",
"value" : {
"useUnicode" : true
},
"type" : "MAP",
"sensitive" : false
}
],
"name" : "JDBC_test_table_Input",
"type" : "LINK"
}
]
}
}
The server returns error:
{
"message": "Detected incorrect link config structure",
"error-code-class": "org.apache.sqoop.error.code.ServerError",
"stack-trace": [
{
"file": "LinkRequestHandler.java",
"line": 146,
"class": "org.apache.sqoop.handler.LinkRequestHandler",
"method": "createUpdateLink"
},
{
"file": "LinkRequestHandler.java",
"line": 68,
"class": "org.apache.sqoop.handler.LinkRequestHandler",
"method": "handleEvent"
},
{
"file": "LinkServlet.java",
"line": 72,
"class": "org.apache.sqoop.server.v1.LinkServlet",
"method": "handlePostRequest"
},
{
"file": "SqoopProtocolServlet.java",
"line": 63,
"class": "org.apache.sqoop.server.SqoopProtocolServlet",
"method": "doPost"
},
{
"file": "HttpServlet.java",
"line": 643,
"class": "javax.servlet.http.HttpServlet",
"method": "service"
},
{
"file": "HttpServlet.java",
"line": 723,
"class": "javax.servlet.http.HttpServlet",
"method": "service"
},
{
"file": "ApplicationFilterChain.java",
"line": 290,
"class": "org.apache.catalina.core.ApplicationFilterChain",
"method": "internalDoFilter"
},
{
"file": "ApplicationFilterChain.java",
"line": 206,
"class": "org.apache.catalina.core.ApplicationFilterChain",
"method": "doFilter"
},
{
"file": "AuthenticationFilter.java",
"line": 622,
"class": "org.apache.hadoop.security.authentication.server.AuthenticationFilter",
"method": "doFilter"
},
{
"file": "DelegationTokenAuthenticationFilter.java",
"line": 291,
"class": "org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter",
"method": "doFilter"
},
{
"file": "AuthenticationFilter.java",
"line": 574,
"class": "org.apache.hadoop.security.authentication.server.AuthenticationFilter",
"method": "doFilter"
},
{
"file": "ApplicationFilterChain.java",
"line": 235,
"class": "org.apache.catalina.core.ApplicationFilterChain",
"method": "internalDoFilter"
},
{
"file": "ApplicationFilterChain.java",
"line": 206,
"class": "org.apache.catalina.core.ApplicationFilterChain",
"method": "doFilter"
},
{
"file": "StandardWrapperValve.java",
"line": 233,
"class": "org.apache.catalina.core.StandardWrapperValve",
"method": "invoke"
},
{
"file": "StandardContextValve.java",
"line": 191,
"class": "org.apache.catalina.core.StandardContextValve",
"method": "invoke"
},
{
"file": "StandardHostValve.java",
"line": 127,
"class": "org.apache.catalina.core.StandardHostValve",
"method": "invoke"
},
{
"file": "ErrorReportValve.java",
"line": 103,
"class": "org.apache.catalina.valves.ErrorReportValve",
"method": "invoke"
},
{
"file": "StandardEngineValve.java",
"line": 109,
"class": "org.apache.catalina.core.StandardEngineValve",
"method": "invoke"
},
{
"file": "CoyoteAdapter.java",
"line": 293,
"class": "org.apache.catalina.connector.CoyoteAdapter",
"method": "service"
},
{
"file": "Http11Processor.java",
"line": 861,
"class": "org.apache.coyote.http11.Http11Processor",
"method": "process"
},
{
"file": "Http11Protocol.java",
"line": 620,
"class": "org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler",
"method": "process"
},
{
"file": "JIoEndpoint.java",
"line": 489,
"class": "org.apache.tomcat.util.net.JIoEndpoint$Worker",
"method": "run"
},
{
"file": "Thread.java",
"line": 745,
"class": "java.lang.Thread",
"method": "run"
}
],
"error-code": "SERVER_0003",
"class": "org.apache.sqoop.common.SqoopException"
}
I read the documentation and can't find solution for right structure of json.
I had some json issue as well, i have found this workaround to be quite useful:
go to the sqoop2 shell (i type sqoop2 in the prompt of the sqoop2 server machine)
when in shell, create the link/job etc' using the shell e.g. 'create link' command
the full doc is here sqoop2 command line shell
now you can fetch the link using the rest api - /v1/link/[lid]

Add filter to a custom controller Dunglas API

I'm trying to add a filter to a custom controller in symfony2 Dunglas api bundle.
I would like to filter my entities by some parameters when I try to get the object collection.
For example I have an entity called "store" that have a attribute "telephone", I would like to filter all stores with this parameter.
The url may be something like :
.../web/app_dev.php/api/stores?_format=json&telephone='1234567'
But I can' add the filter to my controller... If I try to init a filter the error that appear is this one :
{
"#context": "/DKCore/web/app_dev.php/api/contexts/Error",
"#type": "Error",
"hydra:title": "An error occurred",
"hydra:description": "Error: Call to a member function getDescription() on a non-object",
"trace": [
{
"function": "getSearch",
"type": "->",
"class": "Dunglas\\ApiBundle\\Hydra\\Serializer\\CollectionNormalizer",
"file": "/var/www/html/DKCore/vendor/dunglas/api-bundle/Hydra/Serializer/CollectionNormalizer.php",
"line": 127,
"args": []
},
{
"function": "normalize",
"type": "->",
"class": "Dunglas\\ApiBundle\\Hydra\\Serializer\\CollectionNormalizer",
"file": "/var/www/html/DKCore/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php",
"line": 124,
"args": []
},
{
"function": "normalize",
"type": "->",
"class": "Symfony\\Component\\Serializer\\Serializer",
"file": "/var/www/html/DKCore/vendor/dunglas/api-bundle/Controller/ResourceController.php",
"line": 89,
"args": []
},
{
"function": "getSuccessResponse",
"type": "->",
"class": "Dunglas\\ApiBundle\\Controller\\ResourceController",
"file": "/var/www/html/DKCore/src/AppBundle/Controller/StoreController.php",
"line": 43,
"args": []
},
{
"function": "getListAction",
"type": "->",
"class": "AppBundle\\Controller\\StoreController",
"file": "/var/www/html/DKCore/app/bootstrap.php.cache",
"line": 3109,
"args": []
},
{
"function": "call_user_func_array:{/var/www/html/DKCore/app/bootstrap.php.cache:3109}",
"file": "/var/www/html/DKCore/app/bootstrap.php.cache",
"line": 3109,
"args": []
},
{
"function": "handleRaw",
"type": "->",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"file": "/var/www/html/DKCore/app/bootstrap.php.cache",
"line": 3071,
"args": []
},
{
"function": "handle",
"type": "->",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"file": "/var/www/html/DKCore/app/bootstrap.php.cache",
"line": 3222,
"args": []
},
{
"function": "handle",
"type": "->",
"class": "Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel",
"file": "/var/www/html/DKCore/app/bootstrap.php.cache",
"line": 2444,
"args": []
},
{
"function": "handle",
"type": "->",
"class": "Symfony\\Component\\HttpKernel\\Kernel",
"file": "/var/www/html/DKCore/web/app_dev.php",
"line": 29,
"args": []
},
{
"function": "{main}",
"file": "/var/www/html/DKCore/web/app_dev.php",
"line": 0,
"args": []
}
]
}
And this is my custom controller :
namespace AppBundle\Controller;
use Dunglas\ApiBundle\Controller\ResourceController;
use Dunglas\ApiBundle\Event\DataEvent;
use Dunglas\ApiBundle\Event\Events;
use Symfony\Component\HttpFoundation\Request;
use Dunglas\ApiBundle\Api\Resource;
class StoreController extends ResourceController
{
public function getAction(Request $request, $number)
{
$em = $this->getDoctrine()->getManager();
$store = $em->getRepository('AppBundle:Store')->findOneBySiteId($number);
$groups = ['groups' => ['details']];
$resource = new Resource('AppBundle\Entity\Store');
$resource->initNormalizationContext($groups);
$object = $this->findOrThrowNotFound($resource, $store->getId());
$this->get('event_dispatcher')->dispatch(Events::RETRIEVE, new DataEvent($resource, $object));
return $this->getSuccessResponse($resource, $object);
}
public function getListAction(Request $request)
{
$groups = ['groups' => ['list']];
$filters=['telephone'=>'948314796'];
$resource = new Resource('AppBundle\Entity\Store');
$resource->initFilters($filters);
$resource->initNormalizationContext($groups);
$data = $this->getCollectionData($resource, $request);
if (
$request->get($this->container->getParameter('api.collection.pagination.page_parameter_name')) &&
0 === count($data)
) {
throw $this->createNotFoundException();
}
$this->get('event_dispatcher')->dispatch(Events::RETRIEVE_LIST, new DataEvent($resource, $data));
return $this->getSuccessResponse($resource, $data, 200, [], ['request_uri' => $request->getRequestUri()]);
}
}
Thank you so much for your help.
Regards
Do you really need a custom controller? I think you can just use the builtin search filter to do what you want:
# app/config/services.yml
services:
resource.store.search_filter:
parent: "api.doctrine.orm.search_filter"
arguments: [ { telephone: "exact" } ]
resource.store:
parent: "api.resource"
arguments: [ "AppBundle\Entity\Store" ]
calls:
- method: "initFilters"
arguments: [ [ "#resource.store.search_filter" ] ]
tags: [ { name: "api.resource" } ]
Then request GET /api/stores?telephone=1234567 (without quotes).

Chef Selenium: Strange error when I go to the hub ip:4444/wd/hub

I get the following stacktrace:
{
"status": 13,
"value": {
"class": "java.lang.NullPointerException",
"stackTrace": [
{
"fileName": "ExternalSessionKey.java",
"className": "org.openqa.grid.internal.ExternalSessionKey",
"methodName": "fromWebDriverRequest",
"lineNumber": 77
},
{
"fileName": "WebDriverRequest.java",
"className": "org.openqa.grid.web.servlet.handler.WebDriverRequest",
"methodName": "extractSession",
"lineNumber": 62
},
{
"fileName": "RequestHandler.java",
"className": "org.openqa.grid.web.servlet.handler.RequestHandler",
"methodName": "getSession",
"lineNumber": 237
},
{
"fileName": "RequestHandler.java",
"className": "org.openqa.grid.web.servlet.handler.RequestHandler",
"methodName": "process",
"lineNumber": 119
},
{
"fileName": "DriverServlet.java",
"className": "org.openqa.grid.web.servlet.DriverServlet",
"methodName": "process",
"lineNumber": 83
},
{
"fileName": "DriverServlet.java",
"className": "org.openqa.grid.web.servlet.DriverServlet",
"methodName": "doGet",
"lineNumber": 61
},
{
"fileName": "HttpServlet.java",
"className": "javax.servlet.http.HttpServlet",
"methodName": "service",
"lineNumber": 707
},
{
"fileName": "HttpServlet.java",
"className": "javax.servlet.http.HttpServlet",
"methodName": "service",
"lineNumber": 820
},
{
"fileName": "ServletHolder.java",
"className": "org.seleniumhq.jetty7.servlet.ServletHolder",
"methodName": "handle",
"lineNumber": 565
},
{
"fileName": "ServletHandler.java",
"className": "org.seleniumhq.jetty7.servlet.ServletHandler",
"methodName": "doHandle",
"lineNumber": 479
},
{
"fileName": "SessionHandler.java",
"className": "org.seleniumhq.jetty7.server.session.SessionHandler",
"methodName": "doHandle",
"lineNumber": 225
},
{
"fileName": "ContextHandler.java",
"className": "org.seleniumhq.jetty7.server.handler.ContextHandler",
"methodName": "doHandle",
"lineNumber": 1031
},
{
"fileName": "ServletHandler.java",
"className": "org.seleniumhq.jetty7.servlet.ServletHandler",
"methodName": "doScope",
"lineNumber": 406
},
{
"fileName": "SessionHandler.java",
"className": "org.seleniumhq.jetty7.server.session.SessionHandler",
"methodName": "doScope",
"lineNumber": 186
},
{
"fileName": "ContextHandler.java",
"className": "org.seleniumhq.jetty7.server.handler.ContextHandler",
"methodName": "doScope",
"lineNumber": 965
},
{
"fileName": "ScopedHandler.java",
"className": "org.seleniumhq.jetty7.server.handler.ScopedHandler",
"methodName": "handle",
"lineNumber": 117
},
{
"fileName": "HandlerWrapper.java",
"className": "org.seleniumhq.jetty7.server.handler.HandlerWrapper",
"methodName": "handle",
"lineNumber": 111
},
{
"fileName": "Server.java",
"className": "org.seleniumhq.jetty7.server.Server",
"methodName": "handle",
"lineNumber": 349
},
{
"fileName": "AbstractHttpConnection.java",
"className": "org.seleniumhq.jetty7.server.AbstractHttpConnection",
"methodName": "handleRequest",
"lineNumber": 452
},
{
"fileName": "BlockingHttpConnection.java",
"className": "org.seleniumhq.jetty7.server.BlockingHttpConnection",
"methodName": "handleRequest",
"lineNumber": 47
},
{
"fileName": "AbstractHttpConnection.java",
"className": "org.seleniumhq.jetty7.server.AbstractHttpConnection",
"methodName": "headerComplete",
"lineNumber": 884
},
{
"fileName": "AbstractHttpConnection.java",
"className": "org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler",
"methodName": "headerComplete",
"lineNumber": 938
},
{
"fileName": "HttpParser.java",
"className": "org.seleniumhq.jetty7.http.HttpParser",
"methodName": "parseNext",
"lineNumber": 634
},
{
"fileName": "HttpParser.java",
"className": "org.seleniumhq.jetty7.http.HttpParser",
"methodName": "parseAvailable",
"lineNumber": 230
},
{
"fileName": "BlockingHttpConnection.java",
"className": "org.seleniumhq.jetty7.server.BlockingHttpConnection",
"methodName": "handle",
"lineNumber": 66
},
{
"fileName": "SocketConnector.java",
"className": "org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint",
"methodName": "run",
"lineNumber": 254
},
{
"fileName": "QueuedThreadPool.java",
"className": "org.seleniumhq.jetty7.util.thread.QueuedThreadPool",
"methodName": "runJob",
"lineNumber": 599
},
{
"fileName": "QueuedThreadPool.java",
"className": "org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3",
"methodName": "run",
"lineNumber": 534
},
{
"fileName": "Thread.java",
"className": "java.lang.Thread",
"methodName": "run",
"lineNumber": 745
}
]
}
}
Have you seen such errors?
Do you have any idea how to solve this because there is nothing in the log files?
After doing some research, it seems like this is expected behavior and shouldn't impact testing:
https://github.com/nicegraham/selenium-grid2-api/blob/master/README.md#wdhub