0

我有一个非常小的 OSGI 应用程序在 Apache Karaf 中运行,它在 OrientDB 版本 2.1.11 上运行良好。但是当我尝试在新的 2.2.3 版本上启动它时遇到了以下错误:

Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Error on opening database 'remote:/localhost/testdb'
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:187)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPolled.<init>(OPartitionedDatabasePool.java:118)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPolled.<init>(OPartitionedDatabasePool.java:114)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.initQueue(OPartitionedDatabasePool.java:442)

此错误发生在应用程序安装时尝试初始化数据库连接池时。经过一些调试,我发现根本问题出在 com.orientechnologies.orient.core.Orient 类的方法 registerEngines() 中,OrientDB 类加载器试图找到 OEngine 接口的所有实现:

    Iterator<OEngine> engines = OClassLoaderHelper.lookupProviderWithOrientClassLoader(OEngine.class, classLoader);

此调用仅返回 2 个实现,plocal 和内存(位于与 registerEngines() - orientdb-core 相同的包中)。远程引擎 (com.orientechnologies.orient.client.remote.OEngineRemote) 位于 orientdb-client 包中,OrientDB 类加载器找不到它。

这是创建数据库连接轮询并产生描述错误的代码片段:

    log.info("Creating OrientDB connection pool");
    OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_ENABLED.setValue(true);
    OPartitionedDatabasePool connectionPool = new OPartitionedDatabasePool(url, user, password);
    log.info(String.format("Created OrientDB connection pool: url=%s", url));
4

0 回答 0