OrientDB v3.0.0执行Gremlin查询报错:找不到脚本执行器请求者
我之前用OrientDB 3.0.0的时候也碰到过一模一样的问题,折腾了一阵才搞定,给你分享几个实用的解决步骤:
检查并配置OrientDB服务器的Gremlin引擎
打开OrientDB安装目录下的config/orientdb-server-config.xml文件,确保里面已经添加了Gremlin引擎和命令的配置:
首先找到<engines>节点,添加Gremlin引擎配置:<engines> <!-- 保留其他已有的引擎配置 --> <engine id="gremlin" class="com.orientechnologies.orient.graph.gremlin.OGremlinEngine"/> </engines>然后找到
<commands>节点,添加Gremlin命令的支持:<commands> <!-- 保留其他已有的命令配置 --> <command implementation="com.orientechnologies.orient.graph.gremlin.OCommandGremlin" pattern="gremlin.*" interpreter="false"/> </commands>确认Studio的查询语言模式
在OrientDB Studio里执行查询时,一定要留意顶部的语言选择框,必须切换到Gremlin模式,而不是默认的SQL模式。如果选错了模式,服务器会用SQL引擎去解析Gremlin语句,自然会触发这个异常。验证Gremlin相关依赖是否完整
如果你是手动下载的OrientDB安装包,检查lib目录下是否存在orientdb-gremlin-3.0.0.jar以及TinkerPop相关的依赖包(比如tinkerpop-*.jar系列)。如果是用Maven管理项目,确保已经引入了Gremlin的依赖:<dependency> <groupId>com.orientechnologies</groupId> <artifactId>orientdb-gremlin</artifactId> <version>3.0.0</version> </dependency>重启OrientDB服务器
不管是修改了配置文件还是补充了依赖,都需要重启OrientDB服务器,让新的配置和依赖生效。
另外还有个小细节:可以试试把查询语句改成g.V('#21:0')(注意是大写的V),虽然有些版本小写v也能识别,但3.0.0版本对Gremlin语法的兼容性更偏向标准TinkerPop语法,大写V会更稳妥。
内容的提问来源于stack exchange,提问作者Fariba Hashemi

