当我使用控制台时,一切正常,但当我尝试从java应用程序打开数据库时,会出现此错误
WARNING: Sun Unsafe direct memory implementation is going to be used, this implementation is not stable so please use JNA version instead.
Exception in thread "main" com.orientechnologies.common.exception.OException: Error on creation of shared resource
at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:55)
at com.orientechnologies.orient.core.metadata.OMetadataDefault.init(OMetadataDefault.java:110)
at com.orientechnologies.orient.core.metadata.OMetadataDefault.load(OMetadataDefault.java:68)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:132)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:53)
at ru.sersem.bugsaccounting.RegBugs.openDataBase(RegBugs.java:36)
at com.library.test.Test.main(Test.java:5)
Caused by: com.orientechnologies.orient.core.exception.ORecordNotFoundException: The record with id '#0:1' not found
at com.orientechnologies.orient.core.record.ORecordAbstract.reload(ORecordAbstract.java:294)
at com.orientechnologies.orient.core.record.impl.ODocument.reload(ODocument.java:374)
at com.orientechnologies.orient.core.type.ODocumentWrapper.reload(ODocumentWrapper.java:87)
at com.orientechnologies.orient.core.type.ODocumentWrapperNoClass.reload(ODocumentWrapperNoClass.java:69)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared$16.call(OSchemaShared.java:605)
at com.orientechnologies.orient.core.storage.OStorageAbstract.callInLock(OStorageAbstract.java:185)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.callInLock(OLocalPaginatedStorage.java:1322)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.load(OSchemaShared.java:600)
at com.orientechnologies.orient.core.metadata.OMetadataDefault$1.call(OMetadataDefault.java:114)
at com.orientechnologies.orient.core.metadata.OMetadataDefault$1.call(OMetadataDefault.java:110)
at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:53)
... 6 more
Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #0:1 (cluster: internal)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:250)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeReadRecord(ODatabaseRecordAbstract.java:706)
at com.orientechnologies.orient.core.tx.OTransactionNoTx.loadRecord(OTransactionNoTx.java:63)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.reload(ODatabaseRecordTx.java:232)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.reload(ODatabaseRecordTx.java:38)
at com.orientechnologies.orient.core.record.ORecordAbstract.reload(ORecordAbstract.java:287)
... 16 more
Caused by: java.lang.NoClassDefFoundError: org/iq80/snappy/Snappy
at com.orientechnologies.orient.core.serialization.compression.impl.OSnappyCompression.uncompress(OSnappyCompression.java:39)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readRecord(OPaginatedCluster.java:574)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.readRecord(OLocalPaginatedStorage.java:1160)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.readRecord(OLocalPaginatedStorage.java:1140)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:244)
... 21 more
Caused by: java.lang.ClassNotFoundException: org.iq80.snappy.Snappy
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 26 more
我应该配置orientdb-server-config.xml
还是别的什么?
这是我用来连接的代码
public static void openDataBase() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:/database/bugsac");
db.open("admin", "admin");
try {
System.out.println(db.getName());
} finally {
db.close();
}
此处发生错误db.open("admin", "admin");
连接没有错误。你能想到问题是什么吗?
答案 0 :(得分:1)
错误很明显:
java.lang.ClassNotFoundException: org.iq80.snappy.Snappy
你是否在类路径中包含了snappy * .jar?