Исключение: java.lang.NullPointerException при подключении к Базе данных восточного графа. - PullRequest
0 голосов
/ 17 января 2019

Я использую базу данных Orient Graph для своего приложения.Я использую Java API, как показано ниже.

  package Sample.Sample;

    import com.orientechnologies.orient.core.db.ODatabaseSession;
    import com.orientechnologies.orient.core.db.OrientDB;
    import com.orientechnologies.orient.core.db.OrientDBConfig;
    import com.tinkerpop.blueprints.Vertex;
    import com.tinkerpop.blueprints.impls.orient.OrientGraph;
    /**
     * Hello world!
     *
     */
    public class App 
    {
        public static void main( String[] args )
        {
            System.out.println( "Hello World!" );
OrientGraph graph = new OrientGraph("plocal:C://orientdb-3.0.11//databases//Example1","admin", "admin");
        try {
            Vertex vPerson = graph.addVertex("class:Persona");
            vPerson.setProperty("firstName", "John");
            vPerson.setProperty("lastName", "Smith");

            Vertex vAddress = graph.addVertex("class:Addressa");
            vAddress.setProperty("street", "Van Ness Ave.");
            vAddress.setProperty("city", "San Francisco");
            vAddress.setProperty("state", "California");
        } finally {
            graph.shutdown();
        }   
       }
    }

Я использую объект OrientGraph для подключения к базе данных, но я получаю исключение нулевого указателя (исключение показано ниже) при подключении к базе данных.

OrientGraph graph = new OrientGraph ("plocal: C: //orientdb-3.0.11//databases//Example1", "admin", "admin");

Ошибка из-за вышеприведенной строки, даже я заменил двойные косые черты одинарными, но все же ошибка существует

   java.lang.NullPointerException
    at com.orientechnologies.orient.core.storage.index.sbtree.local.OSBTree.iterateEntriesBetweenAscOrder(OSBTree.java:1438)
    at com.orientechnologies.orient.core.storage.index.sbtree.local.OSBTree.iterateEntriesBetween(OSBTree.java:955)
    at com.orientechnologies.orient.core.storage.index.engine.OSBTreeIndexEngine.iterateEntriesBetween(OSBTreeIndexEngine.java:188)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doIterateIndexEntriesBetween(OAbstractPaginatedStorage.java:2912)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.iterateIndexEntriesBetween(OAbstractPaginatedStorage.java:2891)
    at com.orientechnologies.orient.core.index.OIndexOneValue.iterateEntriesBetween(OIndexOneValue.java:156)
    at com.orientechnologies.orient.core.index.OIndexAbstractDelegate.iterateEntriesBetween(OIndexAbstractDelegate.java:110)
    at com.orientechnologies.orient.core.index.OIndexTxAwareOneValue.iterateEntriesBetween(OIndexTxAwareOneValue.java:262)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:371)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.processAndBlock(FetchFromIndexStep.java:312)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:235)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:216)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.syncPull(FetchFromIndexStep.java:81)
    at com.orientechnologies.orient.core.sql.executor.GetValueFromIndexEntryStep$1.fetchNextItem(GetValueFromIndexEntryStep.java:92)
    at com.orientechnologies.orient.core.sql.executor.GetValueFromIndexEntryStep$1.hasNext(GetValueFromIndexEntryStep.java:58)
    at com.orientechnologies.orient.core.sql.executor.FilterByClassStep$1.fetchNextItem(FilterByClassStep.java:50)
    at com.orientechnologies.orient.core.sql.executor.FilterByClassStep$1.hasNext(FilterByClassStep.java:88)
    at com.orientechnologies.orient.core.sql.parser.OLocalResultSet.fetchNext(OLocalResultSet.java:42)
    at com.orientechnologies.orient.core.sql.parser.OLocalResultSet.<init>(OLocalResultSet.java:32)
    at com.orientechnologies.orient.core.sql.parser.OSelectStatement.execute(OSelectStatement.java:267)
    at com.orientechnologies.orient.core.sql.parser.OStatement.execute(OStatement.java:62)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.query(ODatabaseDocumentEmbedded.java:518)
    at com.orientechnologies.orient.core.metadata.security.OSecurityShared.lambda$getUser$0(OSecurityShared.java:616)
    at com.orientechnologies.orient.core.db.OScenarioThreadLocal.executeAsDistributed(OScenarioThreadLocal.java:88)
    at com.orientechnologies.orient.core.metadata.security.OSecurityShared.getUser(OSecurityShared.java:615)
    at com.orientechnologies.orient.core.metadata.security.OSecurityShared.authenticate(OSecurityShared.java:233)
    at com.orientechnologies.orient.core.metadata.security.OSecurityProxy.authenticate(OSecurityProxy.java:107)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.internalOpen(ODatabaseDocumentEmbedded.java:178)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.internalOpen(ODatabaseDocumentEmbedded.java:167)
    at com.orientechnologies.orient.core.db.OrientDBEmbedded.open(OrientDBEmbedded.java:149)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:870)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1992)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:166)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:103)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:99)
    at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:105)
    at Sample.Sample.App.main(App.java:21)

Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Cannot open database 'Example1'
    at com.orientechnologies.orient.core.db.OrientDBEmbedded.open(OrientDBEmbedded.java:153)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:870)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1992)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:166)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:103)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:99)
    at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:105)
    at Sample.Sample.App.main(App.java:21)
Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Cannot open database url=plocal:C:\orientdb-3.0.11\databases/Example1
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.internalOpen(ODatabaseDocumentEmbedded.java:195)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.internalOpen(ODatabaseDocumentEmbedded.java:167)
    at com.orientechnologies.orient.core.db.OrientDBEmbedded.open(OrientDBEmbedded.java:149)
    ... 7 more
Caused by: java.lang.NullPointerException
    at com.orientechnologies.orient.core.storage.index.sbtree.local.OSBTree.iterateEntriesBetweenAscOrder(OSBTree.java:1438)
    at com.orientechnologies.orient.core.storage.index.sbtree.local.OSBTree.iterateEntriesBetween(OSBTree.java:955)
    at com.orientechnologies.orient.core.storage.index.engine.OSBTreeIndexEngine.iterateEntriesBetween(OSBTreeIndexEngine.java:188)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doIterateIndexEntriesBetween(OAbstractPaginatedStorage.java:2912)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.iterateIndexEntriesBetween(OAbstractPaginatedStorage.java:2891)
    at com.orientechnologies.orient.core.index.OIndexOneValue.iterateEntriesBetween(OIndexOneValue.java:156)
    at com.orientechnologies.orient.core.index.OIndexAbstractDelegate.iterateEntriesBetween(OIndexAbstractDelegate.java:110)
    at com.orientechnologies.orient.core.index.OIndexTxAwareOneValue.iterateEntriesBetween(OIndexTxAwareOneValue.java:262)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:371)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.processAndBlock(FetchFromIndexStep.java:312)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:235)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:216)
    at com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep.syncPull(FetchFromIndexStep.java:81)
    at com.orientechnologies.orient.core.sql.executor.GetValueFromIndexEntryStep$1.fetchNextItem(GetValueFromIndexEntryStep.java:92)
    at com.orientechnologies.orient.core.sql.executor.GetValueFromIndexEntryStep$1.hasNext(GetValueFromIndexEntryStep.java:58)
    at com.orientechnologies.orient.core.sql.executor.FilterByClassStep$1.fetchNextItem(FilterByClassStep.java:50)
    at com.orientechnologies.orient.core.sql.executor.FilterByClassStep$1.hasNext(FilterByClassStep.java:88)
    at com.orientechnologies.orient.core.sql.parser.OLocalResultSet.fetchNext(OLocalResultSet.java:42)
    at com.orientechnologies.orient.core.sql.parser.OLocalResultSet.<init>(OLocalResultSet.java:32)
    at com.orientechnologies.orient.core.sql.parser.OSelectStatement.execute(OSelectStatement.java:267)
    at com.orientechnologies.orient.core.sql.parser.OStatement.execute(OStatement.java:62)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.query(ODatabaseDocumentEmbedded.java:518)
    at com.orientechnologies.orient.core.metadata.security.OSecurityShared.lambda$getUser$0(OSecurityShared.java:616)
    at com.orientechnologies.orient.core.db.OScenarioThreadLocal.executeAsDistributed(OScenarioThreadLocal.java:88)
    at com.orientechnologies.orient.core.metadata.security.OSecurityShared.getUser(OSecurityShared.java:615)
    at com.orientechnologies.orient.core.metadata.security.OSecurityShared.authenticate(OSecurityShared.java:233)
    at com.orientechnologies.orient.core.metadata.security.OSecurityProxy.authenticate(OSecurityProxy.java:107)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.internalOpen(ODatabaseDocumentEmbedded.java:178)
    ... 9 more

Я где-то ошибаюсь ??

...