【问题标题】:Error when I try to create a node in Neo4j using everyman and hirevoice module当我尝试使用everyman和hirevoice模块在Neo4j中创建节点时出错
【发布时间】:2014-01-24 17:33:03
【问题描述】:

我正在尝试在 Neo4j 中创建一个节点,但出现以下错误:

普通人\Neo4j\异常

文件:

C:\wamp\www\gtg-zf2\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Command.php:116

消息:

Unable to commit batch [404]:
Headers: Array
(
    [Access-Control-Allow-Origin] =>  *
    [Content-Type] =>  text/html; charset=iso-8859-1
    [Cache-Control] =>  must-revalidate,no-cache,no-store
    [Content-Length] =>  1378
    [Server] =>  Jetty(6.1.25)
)
Body: Array
(
)

堆栈跟踪:

#0 C:\wamp\www\gtg-zf2\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Command\Batch\Command.php(61): Everyman\Neo4j\Command->throwException('Unable to commi...', 404, Array, Array)
#1 C:\wamp\www\gtg-zf2\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Command.php(69): Everyman\Neo4j\Command\Batch\Command->handleResult(404, Array, Array)
#2 C:\wamp\www\gtg-zf2\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Client.php(828): Everyman\Neo4j\Command->execute()
#3 C:\wamp\www\gtg-zf2\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Client.php(151): Everyman\Neo4j\Client->runCommand(Object(Everyman\Neo4j\Command\Batch\Commit))
#4 C:\wamp\www\gtg-zf2\vendor\hirevoice\neo4jphp-ogm\lib\HireVoice\Neo4j\EntityManager.php(497): Everyman\Neo4j\Client->commitBatch()
#5 C:\wamp\www\gtg-zf2\vendor\hirevoice\neo4jphp-ogm\lib\HireVoice\Neo4j\EntityManager.php(424): HireVoice\Neo4j\EntityManager->commit()
#6 C:\wamp\www\gtg-zf2\vendor\hirevoice\neo4jphp-ogm\lib\HireVoice\Neo4j\EntityManager.php(153): HireVoice\Neo4j\EntityManager->writeEntities()
#7 C:\wamp\www\gtg-zf2\module\Social\src\Social\Service\FriendService.php(96): HireVoice\Neo4j\EntityManager->flush()

我在 ZF2 框架上,这是我提交节点的方式:

$em = new Neo4j\EntityManager(array(
    'transport' => 'curl',
    'host' => 'my-host', // my host is fine
    'port' => 7474,
));

$jane = new UserNeo4j;
$jane->setEmail('test@test.fr');
$em->persist($jane);
$em->flush();

我的实体(UserNeo4j.php):

namespace Neo4j\Entity;

use HireVoice\Neo4j\Annotation as OGM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * @OGM\Entity(repositoryClass="Neo4j\Repository\UserNeo4jRepository")
 */
class UserNeo4j
{
/**
 * The internal node ID from Neo4j must be stored. Thus an Auto field is required
 * @OGM\Auto
 */
protected $id;

/**
 * @OGM\Property
 * @OGM\Index
 */
protected $email;


/**
 * @param mixed $id
 * @return $this
 */
public function setId($id)
{
    $this->id = $id;
    return $this;
}

/**
 * @param mixed $email
 * @return $this
 */
public function setEmail($email)
{
    $this->email = $email;
    return $this;
}
}

知道是什么导致了这个错误吗?

【问题讨论】:

  • 在curl传输类中,能把请求体、url和方法dump出来吗?该异常表明您所到达的任何端点都不存在。
  • 我已经测试了命令行:php neo4jphp.phar my-host 并返回:致命错误:未捕获的异常 'Everyman\Neo4j\Exception' 与 phar://C:/wamp 中的消息' /www/test/neo4jphp.phar/lib/Everyman/Neo4j/Command.php 在第 116 行 Everyman\Neo4j\Exception:无法检索服务器信息 [500]:标题:数组()正文:数组([错误] =>无法解析主机:http;未找到主机 [6])在 phar://C:/wamp/www/zf2-gtg/neo4jphp.phar/lib/Everyman/Neo4j/Command.php 第 116 行。
  • 当我回显 getEndpoint() 方法时,它返回:my-host.com:7474/db/data 并且我通过 http 访问此 url 没有问题
  • 您可以尝试使用 Composer 而不是 PHAR 文件安装库吗? PHAR 已经过时了。
  • 我已经使用作曲家了。使用 PHAR 文件只是一个测试。也许我只是一个扩展问题。我的 apache 日志显示 PHP 警告:模块 'curl' 已在第 0 行的 Unknown 中加载...我将重新安装 wamp...

标签: php zend-framework2 neo4j doctrine-odm neo4jphp


【解决方案1】:

我的 ec2 实例配置不当。我已经安装了一个新的,现在一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-01
    • 2015-10-24
    • 2014-12-14
    • 1970-01-01
    • 1970-01-01
    • 2014-01-14
    • 2021-04-16
    相关资源
    最近更新 更多