【问题标题】:What is the proper configuration for Spring Data Neo4j and PlayFramework 2.1.1?Spring Data Neo4j 和 PlayFramework 2.1.1 的正确配置是什么?
【发布时间】:2013-05-12 16:45:27
【问题描述】:

这是我构建的带有 Spring Data Neo4j 骨架应用程序的 PlayFramework:

https://github.com/tomasmuller/playframework-neo4j-template

在第一次play run 期间一切正常。通过 Netty 的 PlayFramework 以开发模式启动。所以我们可以继续编程并点击刷新来查看结果。

但可能缺少一些与 Neo4j 事务管理器相关的配置。甚至这可能与 PlayFramework 的开发模式有关。

例如,尝试将index.scala.html 的第 13 行更改为不同的标题,然后重新加载索引页面而不重新启动服务器。

原来是以下异常:

play.api.PlayException:无法初始化全局对象 [null] ... 原因:org.springframework.beans.factory.BeanCreationException:创建名为“graphDatabaseService”的bean时出错:bean实例化失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:无法实例化 bean 类 [org.neo4j.kernel.EmbeddedGraphDatabase]:构造函数抛出异常;嵌套异常是 java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: 组件 'org.neo4j.kernel.StoreLockerLifecycleAdapter@20346642' 已成功初始化,但无法启动。请参阅附件原因异常。 ... 原因:org.neo4j.kernel.StoreLockException:无法获取存储锁定文件的锁定:target/neo4j-db/store_lock 在 org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:90) ~[neo4j-kernel-1.9.RC1.jar:1.9.RC1] ...

我尝试了一些配置(没有成功)并记录在repository issue n.1

发生了什么事?是配置问题还是与Spring Data Neo4j和PlayFramework的结合有关?

【问题讨论】:

    标签: playframework neo4j spring-data-neo4j


    【解决方案1】:

    “无法获得锁”听起来像是文件系统问题(检查 target/neo4j-db/ 目录的权限等?),也许其中创建了两个?

    【讨论】:

      【解决方案2】:

      app/Global.scalaonStop方法中从Neo4jTemplate调用getGraphDatabaseService.shutdown()解决了这个问题。

      /**
       * Sync the context lifecycle with Play's.
       * @param app
       */
      override def onStop(app: Application) {
        val  neo4jTemplate:Neo4jTemplate = ctx.getBean(classOf[Neo4jTemplate]);
        neo4jTemplate.getGraphDatabaseService.shutdown();
        ctx.stop()
      }
      

      拉取请求here

      【讨论】:

        猜你喜欢
        • 2012-12-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-05-10
        • 2017-10-11
        • 1970-01-01
        • 2015-07-15
        • 2014-06-04
        相关资源
        最近更新 更多