OrientDB core 2.1.20 : OCommandExecutorSQLDelegate.parse has false in if statement's conditional?

45 views
Skip to first unread message

Erik T

unread,
Aug 4, 2016, 2:20:03 PM8/4/16
to OrientDB
Hello,

I was having trouble creating a connection to a graph database in orientDB. I always get 

2016-08-04 14:02:55:993 INFO  OrientDB Server v2.1.20 is active. [OServer]com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.select from OUser where name = ? limit 1
        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:1404)
        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.metadata.security.OSecurityShared.getUser(OSecurityShared.java:522)
        at com.orientechnologies.orient.core.metadata.security.OSecurityShared.authenticate(OSecurityShared.java:163)
        at com.orientechnologies.orient.core.metadata.security.OSecurityProxy.authenticate(OSecurityProxy.java:87)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:268)
        at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1797)
        at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:156)
        at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:102)
        at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:98)
        at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:76)
        at com.tridium.systemDb.orient.BOrientSystemDatabase.connectToDatabase(BOrientSystemDatabase.java:62)
        at com.tridium.systemDb.orient.BOrientSystemDatabase.instantiate(BOrientSystemDatabase.java:47)
        at com.tridium.systemDb.orient.BOrientSystemDatabase.doConnect(BOrientSystemDatabase.java:83)
        at com.tridium.systemDb.BSystemDbService.doConnect(BSystemDbService.java:209)
        at auto.com_tridium_systemDb_BSystemDbService.invoke(AutoGenerated)
        at com.tridium.sys.schema.ComponentSlotMap.invoke(ComponentSlotMap.java:1871)
        at com.tridium.sys.engine.EngineUtil.doInvoke(EngineUtil.java:62)
        at com.tridium.sys.engine.EngineManager.checkAsyncActions(EngineManager.java:420)
        at com.tridium.sys.engine.EngineManager.execute(EngineManager.java:245)
        at com.tridium.sys.engine.EngineManager$EngineThread.run(EngineManager.java:839)

The documentation is vague and not helpful so i step through the code and see this in OCommandExecutorSQLDelegate.parse:

public OCommandExecutorSQLDelegate parse(final OCommandRequest iCommand) {

...

if (textUpperCase.startsWith("SELECT") && false) {
InputStream is = new ByteArrayInputStream(text.getBytes());
OrientSql osql = new OrientSql(is);
try {
// TODO create a cache of parsed statements
OStatement stm = osql.parse();
delegate = stm.buildExecutor(iCommand);
delegate.setContext(context);
delegate.setLimit(iCommand.getLimit());
delegate.setProgressListener(progressListener);
is.close();
} catch (Exception e) {
throwParsingException(e.getMessage());
}
} else {
delegate = (OCommandExecutorSQLAbstract) OSQLEngine.getInstance().getCommand(textUpperCase);
if (delegate == null)
throw new OCommandExecutorNotFoundException("Cannot find a command executor for the command request: " + iCommand);

delegate.setContext(context);
delegate.setLimit(iCommand.getLimit());
delegate.parse(iCommand);
delegate.setProgressListener(progressListener);
}

the query starts with select but the try catch block is never reached because of the hard coded false in the if statement. There aren't any comments to explain this. Why is that there?

Luigi Dell'Aquila

unread,
Aug 5, 2016, 3:05:14 AM8/5/16
to orient-...@googlegroups.com
Hi Erik,

The block with 
if (textUpperCase.startsWith("SELECT") && false) {
is never executed (see the && false), it's there because of some tests, but it's disabled for a reason.
The problem here seems to be in class loading, the SQL engine cannot find the factory that creates the executor for SELECT. 
What kind of deployment are you using? Do you have any specific class loading process (eg. OSGI)?

Thanks

Luigi


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Erik T

unread,
Aug 9, 2016, 12:06:29 PM8/9/16
to OrientDB
Hi Luigi,

I was a bit startled to see a false in the conditional since the reasoning isn't obvious in the code. 

I'm not entirely sure what you mean by 'deployment'. I'm looking to embed orientDb (2.1.20). The build process is written in Gradle. I'm not sure if OSGI is used or not since I'm new to this company and haven't worked with OSGI before. What little progress I have made is finding more dependency issues. I'm able to start the server but I'm unable to make a connection. These segments of code are failing because jna.Platform can not be found but its in my classpath. Its almost like the ClassLoader doesn't see it. Here are two brief examples with what I'm trying:

Example 1 : 
OrientGraphFactory factory = new OrientGraphFactory(*location*, "guest", "guest");
graph = factory.getTx();

Example 2:
graph = new OrientGraph(*location*, "guest", "guest");

Both examples give the following stack trace :

java.lang.NoClassDefFoundError: com/sun/jna/Platform
        at com.orientechnologies.nio.OCLibraryFactory.<clinit>(OCLibraryFactory.java:35)
        at com.orientechnologies.nio.OJNADirectMemory.<clinit>(OJNADirectMemory.java:35)
        at com.orientechnologies.common.directmemory.ODirectMemoryFactory.<clinit>(ODirectMemoryFactory.java:59)
        at com.orientechnologies.common.directmemory.ODirectMemoryPointerFactory.<init>(ODirectMemoryPointerFactory.java:28)
        at com.orientechnologies.common.directmemory.ODirectMemoryPointerFactory.<clinit>(ODirectMemoryPointerFactory.java:24)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog$LogSegment.initPageCache(ODiskWriteAheadLog.java:554)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog$LogSegment.init(ODiskWriteAheadLog.java:275)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:701)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:612)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.initWalAndDiskCache(OLocalPaginatedStorage.java:299)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:169)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:252)
        at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1797)
        at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:156)
        at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:102)
        at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:98)
        at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:103)
        at systemDb.orient.BOrientSystemDatabase.instantiate(BOrientSystemDatabase.java:52)

Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.

Luigi Dell'Aquila

unread,
Aug 9, 2016, 12:10:09 PM8/9/16
to orient-...@googlegroups.com
Hi Erik,

This could just be a classpath issue. What is your Gradle configuration?

Thanks

Luigi


To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages