我的本地 neo4j 数据库路径是 C:\neo4j-community-1.9.3_bup
我创建了一个简单的 java 程序来连接到 neo4j DB 并插入一些节点。
但是在插入后,当我尝试通过 Neo4jDataBrower 检索这些节点时,这些节点没有列出。
我使用的代码取自 neo4j 门户本身,
String DB_PATH = "C\\neo4j-community-1.9.3_bup";
Map<String, String> config = new HashMap<String, String>();
config.put( "neostore.nodestore.db.mapped_memory", "10M" );
config.put( "string_block_size", "60" );
config.put( "array_block_size", "300" );
graphDb = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(DB_PATH).setConfig(config).newGraphDatabase();
registerShutdownHook( graphDb );
Transaction tx = graphDb.beginTx();
try
{
firstNode = graphDb.createNode();
firstNode.setProperty( "message", "Hello, " );
secondNode = graphDb.createNode();
secondNode.setProperty( "message", "World!" );
relationship = firstNode.createRelationshipTo( secondNode, RelTypes.KNOWS );
relationship.setProperty( "message", "brave Neo4j " );
tx.success();
}
finally
{
tx.finish();
}
为什么它不起作用?
请建议我..我给出的 vth 路径是否有问题或 vth 代码有问题?
嗨,维尔纳,
运行时异常是
Exception in thread "main" java.lang.RuntimeException:
org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter@406199' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:280)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:106)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:88)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:207)
at com.Neo4J.src.EmbeddedNeo4j.createDb(EmbeddedNeo4j.java:54)
at com.Neo4J.src.EmbeddedNeo4j.main(EmbeddedNeo4j.java:38)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter@406199' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:497)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:104)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:258)
... 5 more
Caused by: org.neo4j.kernel.StoreLockException: Could not create lock file
at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:74)
at org.neo4j.kernel.StoreLockerLifecycleAdapter.start(StoreLockerLifecycleAdapter.java:40)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:491)
... 7 more
新日志,
Exception in thread "main" java.lang.RuntimeException:
org.neo4j.kernel.lifecycle.LifecycleException:
Component 'org.neo4j.kernel.impl.transaction.TxManager@1827284' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:280)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:106)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:88)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:207)
at com.Neo4J.src.EmbeddedNeo4j.createDb(EmbeddedNeo4j.java:57)
at com.Neo4J.src.EmbeddedNeo4j.main(EmbeddedNeo4j.java:41)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component
'org.neo4j.kernel.impl.transaction.TxManager@1827284' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:497)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:104)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:258)
... 5 more
Caused by: org.neo4j.graphdb.TransactionFailureException:
Unable to start TM, no active tx log file found but found either tm_tx_log.1 or tm_tx_log.2 file, please set one of them as active or remove them.
at org.neo4j.kernel.impl.transaction.TxManager.openLog(TxManager.java:750)
at org.neo4j.kernel.impl.transaction.TxManager.start(TxManager.java:138)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:491)
... 7 more
新的例外,
Sep 27, 2013 11:09:27 AM org.neo4j.server.logging.Logger log
INFO: Starting Neo Server on port [7474] with [40] threads available
2013-09-27 11:09:27.665:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
Sep 27, 2013 11:09:27 AM org.neo4j.server.logging.Logger log
INFO: Using database at C:\neo4j-community-1.9.3_bup\data\graph.db
Exception in thread "main" java.lang.NoSuchFieldError: remote_shell_enabled
at org.neo4j.server.database.Database.createDatabase(Database.java:77)
at org.neo4j.server.database.Database.<init>(Database.java:55)
at org.neo4j.server.NeoServerWithEmbeddedWebServer.startDatabase(NeoServerWithEmbeddedWebServer.java:179)
at org.neo4j.server.NeoServerWithEmbeddedWebServer.start(NeoServerWithEmbeddedWebServer.java:93)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:87)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:76)
at com.Neo4J.src.EmbeddedNeo4j.createDb(EmbeddedNeo4j.java:69)
at com.Neo4J.src.EmbeddedNeo4j.main(EmbeddedNeo4j.java:41)