gotask icon indicating copy to clipboard operation
gotask copied to clipboard

No entry or class found for 'MongoProxy.InsertOne'

Open bain2018 opened this issue 3 years ago • 0 comments

运行一段时间后,报错 ,hyperf 版本是2.2最新版本 log.ERROR: Insert Document hybrid error 'Hyperf\Di\Exception\NotFoundException: No entry or class found for 'MongoProxy.InsertOne'(0) in /app/web/accept/vendor/hyperf/di/src/Container.php:79 Stack trace: #0 /app/web/accept/vendor/hyperf/di/src/Container.php(127): Hyperf\Di\Container->make() #1 /app/web/accept/vendor/hyperf/gotask/src/IPC/SocketIPCReceiver.php(130): Hyperf\Di\Container->get() #2 /app/web/accept/vendor/hyperf/gotask/src/IPC/SocketIPCReceiver.php(85): Hyperf\GoTask\IPC\SocketIPCReceiver->dispatch() #3 {main}' on 'Hyperf\GoTask\Relay\CoroutineSocketRelay'

    public function __construct(ContainerInterface $container,MongoClient $client)
    {
        $this->container = $container;
        $this->logger =$container->get(LoggerFactory::class)->get("log");
        $this->database = $client->database('test');
    }

    public function insertOne(string $collect,array $data)
    {
        try{
            return $this->database->collection($collect)->insertOne($data);
        }catch (\Throwable $e){
            $this->logger->error("Insert Document {$collect} ".$e->getMessage());
        }
        return null;
    }

bain2018 avatar Jan 31 '23 12:01 bain2018