2016-06-07 63 views
0

我試圖用java連接到orient db時出現異常。下面是我得到的例外。如何更正異常database.ocf'被orientdb中的另一個進程鎖定?

Jun 07, 2016 12:43:40 PM com.orientechnologies.common.log.OLogManager log 
INFO: OrientDB auto-config DISKCACHE=891MB (heap=891MB direct=891MB os=4,006MB), assuming maximum direct memory size equals to maximum JVM heap size 
Jun 07, 2016 12:43:40 PM com.orientechnologies.common.log.OLogManager log 
WARNING: MaxDirectMemorySize JVM option is not set or has invalid value, that may cause out of memory errors. Please set the -XX:MaxDirectMemorySize=4006m option when you start the JVM. 
Jun 07, 2016 12:43:40 PM com.orientechnologies.common.log.OLogManager log 
WARNING: MaxDirectMemorySize JVM option is not set or has invalid value, that may cause out of memory errors. Please set the -XX:MaxDirectMemorySize=4006m option when you start the JVM. 
Exception in thread "main" com.orientechnologies.orient.core.exception.OFileLockedByAnotherProcessException: File 'F:\Program Files\orientdb-community-2.2.0\databases\mydbo\database.ocf' is locked by another process, maybe the database is in use by another process. Use the remote mode with a OrientDB server to allow multiple access to the same database at com.orientechnologies.orient.core.storage.fs.OFileClassic.lock(OFileClassic.java:756) 
    at com.orientechnologies.orient.core.storage.fs.OFileClassic.openChannel(OFileClassic.java:813) 
    at com.orientechnologies.orient.core.storage.fs.OFileClassic.open(OFileClassic.java:603) 
    at com.orientechnologies.orient.core.storage.impl.local.OSingleFileSegment.open(OSingleFileSegment.java:51) 
    at com.orientechnologies.orient.core.storage.impl.local.OStorageConfigurationSegment.load(OStorageConfigurationSegment.java:80) 
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:186) 
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:231) 
    at orient.insert.Insert.main(Insert.java:12) 

這是我試過的代碼。

ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:F:/Program Files/orientdb-community-2.2.0/databases/mydbo").open("admin", "admin"); 

ODocument doc = new ODocument("Person"); 
doc.field("name", "Luke"); 
doc.field("surname", "Skywalker"); 
doc.field("city", new ODocument("City").field("name","Rome").field("country", "Italy")); 


doc.save(); 
db.close(); 

我不能找出我有錯誤。請幫助我

回答

3

您有一臺服務器正在運行,您嘗試從另一個進程中以plocal打開數據庫。 請確認您在使用plocal(控制檯或外部進程)訪問它時沒有活動的OrientDB實例,並且您一次打開一個plocal連接?

+0

我在運行分佈式服務器時也面臨同樣的問題 –

相關問題