0
votes

I am running an embedded server in a Java EE application on a single JVM (at the moment). The app server is WAS 8.5 with Java 7.

Here is how I initialize the server:

            log.info("warming up database server bean...");
        workingFolder = (String) lookup(RESOURCE_WORKING_FOLDER);

        String orientdbHome = new File(workingFolder).getAbsolutePath() + "/orientdb"; //Set OrientDB home to current directory
        System.setProperty("ORIENTDB_HOME", orientdbHome);

        String serverConfig = orientdbHome + "/config/orientdb-server-config.xml";

        log.info("statring orientdb from: " + orientdbHome + ", the server config file: " + serverConfig);
        server = OServerMain.create();
        server.startup(new File(serverConfig));
        server.activate();
        log.info("orientdb server started successfully: " + server.isActive());

I am referencing the default server configuration file on the 2.1.16 release. I made those two changes to the file: 1) Enabled Hazelcast plug-in, 2) Add this user: <user resources="*" password="password" name="root"/>.

It seems to initialize correctly, I can even connect to the Studio app and manipulate data from there, no sign of errors.

However, I cannot connect from the "console" app.

I get this on the client:

orientdb> connect remote:192.168.3.12 root password

Connecting to remote Server instance [remote:192.168.3.12] with user 'root'... Error: com.orientechnologies.orient.core.exception.OStorageException: Cannot connect to the remote server/database 'remote:192.168.3.12/'

Error: com.orientechnologies.common.io.OIOException: Cannot open a connection to remote server: 192.168.3.12:2424/

Error: com.orientechnologies.common.io.OIOException: Error on connecting to 192.168.3.12:2424

Error: com.orientechnologies.orient.enterprise.channel.binary.ONetworkProtocolException: Cannot read protocol version from remote server /192.168.3.12:2424: java.net.SocketTimeoutException: Read timed out

And that on the server:

[4/20/16 15:03:18:128 EDT] 000001d8 OServerNetwor E Error on client connection java.lang.NoClassDefFoundError: com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryServer (initialization failure) at java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:284) at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.config(OBinaryNetworkProtocolAbstract.java:89) at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.config(ONetworkProtocolBinary.java:116) at com.orientechnologies.orient.server.network.OServerNetworkListener.run(OServerNetworkListener.java:216) Caused by: java.lang.NoClassDefFoundError: com.orientechnologies.orient.enterprise.channel.OChannel$1 at com.orientechnologies.orient.enterprise.channel.OChannel.(OChannel.java:60) ... 3 more Caused by: java.lang.ClassNotFoundException: com.orientechnologies.orient.enterprise.channel.OChannel$1 at java.net.URLClassLoader.findClass(URLClassLoader.java:665) at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:230) at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:942) at java.lang.ClassLoader.loadClass(ClassLoader.java:877) at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:123) at java.lang.ClassLoader.loadClass(ClassLoader.java:827) at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62) at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:616) at java.lang.ClassLoader.loadClass(ClassLoader.java:827) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584) at java.lang.ClassLoader.loadClass(ClassLoader.java:827) ... 4 more

Here are the Maven dependencies included in my app:

<dependency>
    <groupId>com.orientechnologies</groupId>
    <artifactId>orientdb-jdbc</artifactId>
    <version>2.1.16</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.orientechnologies</groupId>
    <artifactId>orientdb-enterprise</artifactId>
    <version>2.1.16</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.orientechnologies</groupId>
    <artifactId>orientdb-server</artifactId>
    <version>2.1.16</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.orientechnologies</groupId>
    <artifactId>orientdb-object</artifactId>
    <version>2.1.16</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.orientechnologies</groupId>
    <artifactId>orientdb-distributed</artifactId>
    <version>2.1.16</version>
    <scope>compile</scope>
</dependency>
1

1 Answers

1
votes

I figured out the issue.

While reviewing the startup logs, I noticed this:

[4/20/16 15:16:47:077 EDT] 000000df OServerNetwor I Port 0.0.0.0:2424 busy, trying the next available... [4/20/16 15:16:47:077 EDT] 000000df OServerNetwor I Listening binary connections on 0.0.0.0:2425 (protocol v.32, socket=default)

Something is interfering with port 2424 (perhaps a previous failed attempt at implementing this) so was using the next available port.

The "console" was trying to connect to port 2424. As soon as I manually specified port 2425, it worked.