UnexpectedUpgradingStoreVersionException - "Expected 'v0.A.3' but file is version " 与 Neo4j 服务器和 Hibernate OGM
UnexpectedUpgradingStoreVersionException - "Expected 'v0.A.3' but file is version " with Neo4j Server and Hibernate OGM
我正在尝试 Neo4j + Hibernate OGM。我从 this tutorial. Starting from there I am now able to create and update entities, and also run some custom queries using JP-QL queries: 1, 2.
开始
使用Neo4j Community Edition 3.1.0 for Windows 64 bit,选择我的嵌入式数据库的数据目录,然后导航到网络视图,我能够成功查看数据。
然而,在那之后,我在运行我的Java应用程序中遇到了以下问题。
当我尝试运行应用程序时,同时Neo4j社区版服务器也在运行ning,我遇到了以下问题:
org.neo4j.kernel.StoreLockException: Store and its lock file has been locked by another process: target\test_data_dir\store_lock. Please ensure no other process is using this database, and that the directory is writable (required even for read-only access)
这个错误似乎很容易解释,可以通过停止服务器来解决。我的问题是,有没有tool/configuration,可以让我同时做这两个事情;即运行应用程序,并在服务器中查看数据。
我在停止服务器并再次 运行 应用程序后遇到的另一个主要错误是下面的错误。
org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnexpectedUpgradingStoreVersionException: 'G:\Workspace\Java\Neo4jTest\target\test_data_dir\neostore.nodestore.db' has a store version number that we cannot upgrade from. Expected 'v0.A.3' but file is version '
如果我删除数据库并再次启动应用程序(从头开始),那么在我启动服务器之前一切正常。如何解决?
附加信息:
我的 Maven 依赖项:
<dependencies>
<!-- https://mvnrepository.com/artifact/org.hibernate.ogm/hibernate-ogm-neo4j -->
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-neo4j</artifactId>
<version>5.0.4.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jboss.jbossts/jbossjta -->
<dependency>
<groupId>org.jboss.jbossts</groupId>
<artifactId>jbossjta</artifactId>
<version>4.16.6.Final</version>
</dependency>
</dependencies>
我的persitence.xml
:
<?xml version="1.0" encoding="utf-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="hikePu" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<properties>
<property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" />
<property name="hibernate.ogm.datastore.database" value="HikeDB" />
<property name="hibernate.ogm.neo4j.database_path" value="target/test_data_dir" />
<property name="hibernate.ogm.neo4j.configuration_resource_name" value="target/test_data_dir/_myNeo4j.conf" />
</properties>
</persistence-unit>
_myNeo4j.conf
:
#***************************************************************
# Server configuration
#***************************************************************
# This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or uncomment it to
# allow files to be loaded from anywhere in filesystem; this introduces possible security problems. See the `LOAD CSV`
# section of the manual for details.
dbms.directories.import=import
# Require (or disable the requirement of) auth to access Neo4j
dbms.security.auth_enabled=true
# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
#dbms.connectors.default_listen_address=0.0.0.0
# You can also choose a specific network interface, and configure a non-default
# port for each connector, by setting their individual listen_address.
# The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or
# it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for
# individual connectors below.
#dbms.connectors.default_advertised_address=localhost
# You can also choose a specific advertised hostname or IP address, and
# configure an advertised port for each connector, by setting their
# individual advertised_address.
# Bolt connector
dbms.connector.bolt.enabled=true
#dbms.connector.bolt.tls_level=OPTIONAL
#dbms.connector.bolt.listen_address=:7687
# HTTP Connector
dbms.connector.http.enabled=true
#dbms.connector.http.listen_address=:#{default.http.port}
# HTTPS Connector
dbms.connector.https.enabled=true
#dbms.connector.https.listen_address=:#{default.https.port}
# Certificates directory
# dbms.directories.certificates=certificates
#*****************************************************************
# Administration client configuration
#*****************************************************************
# Comma separated list of JAX-RS packages containing JAX-RS resources, one
# package name for each mountpoint. The listed package names will be loaded
# under the mountpoints specified. Uncomment this line to mount the
# org.neo4j.examples.server.unmanaged.HelloWorldResource.java from
# neo4j-examples under /examples/unmanaged, resulting in a final URL of
# http://localhost:${default.http.port}/examples/unmanaged/helloworld/{nodeId}
#dbms.unmanaged_extension_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged
#*****************************************************************
# HTTP logging configuration
#*****************************************************************
# HTTP logging is disabled. HTTP logging can be enabled by setting this
# property to 'true'.
dbms.logs.http.enabled=false
# Enable this to be able to upgrade a store from an older version.
dbms.allow_format_migration=true
# The amount of memory to use for mapping the store files, in bytes (or
# kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g').
# If Neo4j is running on a dedicated server, then it is generally recommended
# to leave about 2-4 gigabytes for the operating system, give the JVM enough
# heap to hold all your transaction state and query context, and then leave the
# rest for the page cache.
# The default page cache memory assumes the machine is dedicated to running
# Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size.
#dbms.memory.pagecache.size=10g
# Enable this to specify a parser other than the default one.
#cypher.default_language_version=2.0
# Keep logical logs, helps debugging but uses more disk space, enabled for
# legacy reasons To limit space needed to store historical logs use values such
# as: "7 days" or "100M size" instead of "true".
#dbms.tx_log.rotation.retention_policy=7 days
# Enable shell server so that remote clients can connect via Neo4j shell.
#dbms.shell.enabled=true
# The network interface IP the shell will listen on (use 0.0.0.0 for all interfaces).
#dbms.shell.host=127.0.0.1
# The port the shell will listen on, default is 1337.
#dbms.shell.port=1337
allow_store_upgrade=true
同一时间只有一个进程可以获得嵌入式 Neo4j 上的锁。
因此,如果您使用的是 OGM,则无法使用 Neo4j 服务器或 vicecersa 访问它。我认为目前没有任何方法可以解决这个问题。
如果您想在应用程序 运行 时检查数据库,您需要使用 Bolt 协议或 HTTP API 连接到服务器。您只需要更新 Hibernate OGM 配置文件。
Hibernate OGM 5.0.4.Final 使用的是旧版本的 Neo4j:2.3.5
当您打开和关闭服务器时,文件版本发生变化,Hibernate OGM 无法再识别它。
Hibernate OGM 5.1.0.Beta3 目前正在使用 Neo4j 3.0.8,但我打开了一个问题来升级它。
我正在尝试 Neo4j + Hibernate OGM。我从 this tutorial. Starting from there I am now able to create and update entities, and also run some custom queries using JP-QL queries: 1, 2.
开始使用Neo4j Community Edition 3.1.0 for Windows 64 bit,选择我的嵌入式数据库的数据目录,然后导航到网络视图,我能够成功查看数据。
然而,在那之后,我在运行我的Java应用程序中遇到了以下问题。
当我尝试运行应用程序时,同时Neo4j社区版服务器也在运行ning,我遇到了以下问题:
org.neo4j.kernel.StoreLockException: Store and its lock file has been locked by another process: target\test_data_dir\store_lock. Please ensure no other process is using this database, and that the directory is writable (required even for read-only access)
这个错误似乎很容易解释,可以通过停止服务器来解决。我的问题是,有没有tool/configuration,可以让我同时做这两个事情;即运行应用程序,并在服务器中查看数据。
我在停止服务器并再次 运行 应用程序后遇到的另一个主要错误是下面的错误。
org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnexpectedUpgradingStoreVersionException: 'G:\Workspace\Java\Neo4jTest\target\test_data_dir\neostore.nodestore.db' has a store version number that we cannot upgrade from. Expected 'v0.A.3' but file is version '
如果我删除数据库并再次启动应用程序(从头开始),那么在我启动服务器之前一切正常。如何解决?
附加信息:
我的 Maven 依赖项:
<dependencies> <!-- https://mvnrepository.com/artifact/org.hibernate.ogm/hibernate-ogm-neo4j --> <dependency> <groupId>org.hibernate.ogm</groupId> <artifactId>hibernate-ogm-neo4j</artifactId> <version>5.0.4.Final</version> </dependency> <!-- https://mvnrepository.com/artifact/org.jboss.jbossts/jbossjta --> <dependency> <groupId>org.jboss.jbossts</groupId> <artifactId>jbossjta</artifactId> <version>4.16.6.Final</version> </dependency> </dependencies>
我的
persitence.xml
:<?xml version="1.0" encoding="utf-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="hikePu" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider> <properties> <property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" /> <property name="hibernate.ogm.datastore.database" value="HikeDB" /> <property name="hibernate.ogm.neo4j.database_path" value="target/test_data_dir" /> <property name="hibernate.ogm.neo4j.configuration_resource_name" value="target/test_data_dir/_myNeo4j.conf" /> </properties> </persistence-unit>
_myNeo4j.conf
:#*************************************************************** # Server configuration #*************************************************************** # This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or uncomment it to # allow files to be loaded from anywhere in filesystem; this introduces possible security problems. See the `LOAD CSV` # section of the manual for details. dbms.directories.import=import # Require (or disable the requirement of) auth to access Neo4j dbms.security.auth_enabled=true # With default configuration Neo4j only accepts local connections. # To accept non-local connections, uncomment this line: #dbms.connectors.default_listen_address=0.0.0.0 # You can also choose a specific network interface, and configure a non-default # port for each connector, by setting their individual listen_address. # The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or # it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for # individual connectors below. #dbms.connectors.default_advertised_address=localhost # You can also choose a specific advertised hostname or IP address, and # configure an advertised port for each connector, by setting their # individual advertised_address. # Bolt connector dbms.connector.bolt.enabled=true #dbms.connector.bolt.tls_level=OPTIONAL #dbms.connector.bolt.listen_address=:7687 # HTTP Connector dbms.connector.http.enabled=true #dbms.connector.http.listen_address=:#{default.http.port} # HTTPS Connector dbms.connector.https.enabled=true #dbms.connector.https.listen_address=:#{default.https.port} # Certificates directory # dbms.directories.certificates=certificates #***************************************************************** # Administration client configuration #***************************************************************** # Comma separated list of JAX-RS packages containing JAX-RS resources, one # package name for each mountpoint. The listed package names will be loaded # under the mountpoints specified. Uncomment this line to mount the # org.neo4j.examples.server.unmanaged.HelloWorldResource.java from # neo4j-examples under /examples/unmanaged, resulting in a final URL of # http://localhost:${default.http.port}/examples/unmanaged/helloworld/{nodeId} #dbms.unmanaged_extension_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged #***************************************************************** # HTTP logging configuration #***************************************************************** # HTTP logging is disabled. HTTP logging can be enabled by setting this # property to 'true'. dbms.logs.http.enabled=false # Enable this to be able to upgrade a store from an older version. dbms.allow_format_migration=true # The amount of memory to use for mapping the store files, in bytes (or # kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g'). # If Neo4j is running on a dedicated server, then it is generally recommended # to leave about 2-4 gigabytes for the operating system, give the JVM enough # heap to hold all your transaction state and query context, and then leave the # rest for the page cache. # The default page cache memory assumes the machine is dedicated to running # Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size. #dbms.memory.pagecache.size=10g # Enable this to specify a parser other than the default one. #cypher.default_language_version=2.0 # Keep logical logs, helps debugging but uses more disk space, enabled for # legacy reasons To limit space needed to store historical logs use values such # as: "7 days" or "100M size" instead of "true". #dbms.tx_log.rotation.retention_policy=7 days # Enable shell server so that remote clients can connect via Neo4j shell. #dbms.shell.enabled=true # The network interface IP the shell will listen on (use 0.0.0.0 for all interfaces). #dbms.shell.host=127.0.0.1 # The port the shell will listen on, default is 1337. #dbms.shell.port=1337 allow_store_upgrade=true
同一时间只有一个进程可以获得嵌入式 Neo4j 上的锁。
因此,如果您使用的是 OGM,则无法使用 Neo4j 服务器或 vicecersa 访问它。我认为目前没有任何方法可以解决这个问题。
如果您想在应用程序 运行 时检查数据库,您需要使用 Bolt 协议或 HTTP API 连接到服务器。您只需要更新 Hibernate OGM 配置文件。
Hibernate OGM 5.0.4.Final 使用的是旧版本的 Neo4j:2.3.5 当您打开和关闭服务器时,文件版本发生变化,Hibernate OGM 无法再识别它。
Hibernate OGM 5.1.0.Beta3 目前正在使用 Neo4j 3.0.8,但我打开了一个问题来升级它。