Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when executing live query from java client library #5450

Closed
fabianmeyer opened this issue Dec 10, 2015 · 2 comments
Closed
Assignees
Labels

Comments

@fabianmeyer
Copy link

When exeucting a OSQLSynchQuery on a document database, using the java client library, everything works find. When executing the same query string as a OLiveQuery, starting with the "live" keyword (as shown in the documentation http://orientdb.com/docs/2.1/Live-Query.html), a "com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException" will occur.

com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.LIVE SELECT FROM Ontology
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:72)
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:42)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1517)
    at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72)
    at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:85)
    at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1323)
    at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:400)
    at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:223)
    at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)

When executing the same OLiveQuery without the "live" keyword, a NullPointerException will occur.

com.orientechnologies.orient.core.exception.OStorageException: Error on executing command: sql.SELECT FROM Ontology
    at com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1768)
    at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1241)
    at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:444)
    at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72)
    at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:85)
    at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
    at com.orientechnologies.orient.core.sql.query.OLiveQuery.execute(OLiveQuery.java:18)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.query(ODatabaseDocumentTx.java:719)
    ... 2 more
Caused by: java.lang.NullPointerException
    at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1218)
    ... 8 more

Example code:

        String qwryString = "SELECT FROM Ontology";

        // Simply query - Works just fine
        db.query(new OSQLSynchQuery<>(qwryString)).stream().map(res -> res.toString()).forEach(System.out::println);

        // Live query with 'live' keyword -> OCommandExecutorNotFoundException
        try {
            db.query(new OLiveQuery<>("LIVE " + qwryString, listener));
        } catch (Throwable t) {
            t.printStackTrace();
        }

        // Live query without 'live' keyword -> NullPointerException
        try {
            db.query(new OLiveQuery<>(qwryString, listener));
        } catch (Throwable t) {
            t.printStackTrace();
        }
@luigidellaquila
Copy link
Member

Hi @fabianmeyer

Which version are you using? If you are in 2.1.x, did you enable the LiveQuery plugin?

Thanks

Luigi

@fabianmeyer
Copy link
Author

Hi, thanks for the fast answer! I'm, in fact, using 2.1.6 and missed the section in the documentation stating that it is disabled by default before 2.2.

Sorry for the inconvinience, it works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants