Search code examples
javaorientdborientdb2.2

OrientDB 'engine 'remote' was not found'


Im using the community orientdb 2.2.12. When I run the app inside IntelliJ everything works fine. However, when I compile the project I get the following error:

Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error on opening database: the engine 'remote' was not found. URL was: remote:xxxxxx/test1. Registered engines are: [memory, plocal]
    DB name="remote:xxxxxx/test1"
    at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:462)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:171)
    ... 13 more

POM:

        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-core</artifactId>
            <version>${orientdb-version}</version>
        </dependency>
        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-graphdb</artifactId>
            <version>${orientdb-version}</version>
        </dependency>
        <dependency>
            <groupId>com.tinkerpop.blueprints</groupId>
            <artifactId>blueprints-core</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-client</artifactId>
            <version>${orientdb-version}</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>4.2.0</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
            <artifactId>concurrentlinkedhashmap-lru</artifactId>
            <version>1.4.2</version>
        </dependency>

I checked the Shaded JAR and it contains all the orientdb-client-*.

The code where the exception is being thrown:

public OrientGraphFactory factory() {

    final int THREADS = Runtime.getRuntime().availableProcessors() + 1;

    return new OrientGraphFactory(
        AppConfig.getDatabaseConnectionString(),
        AppConfig.getDatabaseUsername(),
        AppConfig.getDatabaseSecret()).setupPool(THREADS, THREADS + 10);

}

Solution

  • AFAIU you're trying to build an uberJar with your app code and OrientDB code. To include the right dependencies, my suggestion is to copy the list from the distribution pom.xml:

    https://github.com/orientechnologies/orientdb/blob/master/distribution/pom.xml

    Why does it work in IntelliJ? Well, the IDE, even Eclipse, has a single classpath, that includes test sources and test jars. When you build with maven, it has a "test" classpath, same as the one in idea, and a runtime classpath without test jars (and without transitive dependency of test jars!!!).

    About the remote connection, you need a running standalone OrientDB server to connect to, or at least your application should run an embedded server.

    Hope this help.