【发布时间】:2020-06-20 18:04:11
【问题描述】:
以下测试用例(假设密码正确)
<?php
require 'vendor/autoload.php';
use GraphAware\Neo4j\Client\ClientBuilder;
$client = ClientBuilder::create()
->addConnection('default','http://neo4j:neo4j@localhost:7474')
->build();
$result = $client->run('match (n:person) return n');
给我以下错误:
Fatal error: Uncaught Http\Client\Common\Exception\ClientErrorException: Unsupported Media Type in C:\Users\Ali\Desktop\Xamp\htdocs\Neo4j\vendor\php-http\client-common\src\Plugin\ErrorPlugin.php:72 Stack trace: #0 C:\Users\Ali\Desktop\Xamp\htdocs\Neo4j\vendor\php-http\client-common\src\Plugin\ErrorPlugin.php(54):HttpClientCommonPluginErrorPlugin->transformResponseToException(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 C:\Users\Ali\Desktop\Xamp\htdocs\Neo4j\vendor\php-http\httplug\src\Promise\HttpFulfilledPromise.php(34): Http\Client\Common\Plugin\ErrorPlugin->Http\Client\Common\Plugin\{closure}(Object(GuzzleHttp\Psr7\Response)) #2 C:\Users\Ali\Desktop\Xamp\htdocs\Neo4j\vendor\php-http\client-common\src\Plugin\ErrorPlugin.php(55): Http\Client\Promise\HttpFulfilledPromise->then(Object(Closure)) #3 C:\Users\Ali\Desktop\Xamp\htdocs\Neo4j\vendor\php-http\client-common\src\PluginClient.php(161): Http\Client\Common\Plugin\ErrorPlugin->handleRequest(Object(GuzzleHttp\Psr7\Request), Object(Closure), in C:\Users\Ali\Desktop\Xamp\htdocs\Neo4j\vendor\php-http\client-common\src\Plugin\ErrorPlugin.php on line 72
这是我 var_dump 时的 $client:
object(GraphAware\Neo4j\Client\Client)#7 (2) {
["connectionManager":protected]=>
object(GraphAware\Neo4j\Client\Connection\ConnectionManager)#2 (2) {
["connections":"GraphAware\Neo4j\Client\Connection\ConnectionManager":private]=>
array(1) {
["default"]=>
object(GraphAware\Neo4j\Client\Connection\Connection)#4 (5) {
["alias":"GraphAware\Neo4j\Client\Connection\Connection":private]=>
string(7) "default"
["uri":"GraphAware\Neo4j\Client\Connection\Connection":private]=>
string(38) "http://neo4j:Password@localhost:7474"
["driver":"GraphAware\Neo4j\Client\Connection\Connection":private]=>
object(GraphAware\Neo4j\Client\HttpDriver\Driver)#6 (2) {
["uri":protected]=>
string(38) "http://neo4j:Password@localhost:7474"
["config":protected]=>
object(GraphAware\Neo4j\Client\HttpDriver\Configuration)#5 (1) {
["timeout":protected]=>
int(5)
}
}
["session":"GraphAware\Neo4j\Client\Connection\Connection":private]=>
NULL
["timeout":"GraphAware\Neo4j\Client\Connection\Connection":private]=>
int(5)
}
}
["master":"GraphAware\Neo4j\Client\Connection\ConnectionManager":private]=>
NULL
}
["eventDispatcher":protected]=>
object(Symfony\Component\EventDispatcher\EventDispatcher)#8 (2) {
["listeners":"Symfony\Component\EventDispatcher\EventDispatcher":private]=>
array(0) {
}
["sorted":"Symfony\Component\EventDispatcher\EventDispatcher":private]=>
array(0) {
}
}
}
我不知道如何解释这个或有什么问题。
-
我的数据库在 neo4j 浏览器客户端中运行正常。
-
据我所知,graphaware 已正确安装,根据
网站上的说明。 -
我已经测试过,错误发生在运行查询时, 不是在创建客户端时(即使这不是 错误清楚地表明)
-
如果我将查询直接复制/粘贴到 neo4j 浏览器客户端 然后它按预期工作。
知道为什么我会收到此错误吗?
【问题讨论】: