远程模式下的SparkGraphComputer的Tinkerpop Gremlin服务器MissingPropertyException

时间:2017-07-21 13:39:45

标签: groovy titan tinkerpop3 janusgraph

我是tinkerpop,gremlin和groovy的新手。 我已经配置了Tinkerpop Gremlin服务器和控制台[v3.2.3],并验证了与HDFS和Spark的集成。

接下来我尝试在本地模式下使用gremlin控制台执行下面的代码,一切正常,提交并成功处理了一个spark作业。

:load data/grateful-dead-janusgraph-schema.groovy
graph = JanusGraphFactory.open('conf/connection.properties')
defineGratefulDeadSchema(graph)
graph.close()

hdfs.copyFromLocal('data/grateful-dead.kryo','data/grateful-dead.kryo')

graph = GraphFactory.open('conf/hadoop-graph/hadoop-load.properties')
blvp = BulkLoaderVertexProgram.build().writeGraph('conf/connection.properties').create(graph)
graph.compute(SparkGraphComputer).program(blvp).submit().get()

接下来,我使用以下命令将gremlin控制台连接到gremlin服务器作为远程。

:remote connect tinkerpop.server conf/remote.yaml

在此之后,我使用“:>”执行上面的代码前缀语句。一旦我提交了向SparkGraphComputer提交处理的最后一行,我就会在服务器上得到以下异常 -

[WARN] AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=097785d6-7114-44fb-acbc-1b116dfdaac2, op='eval', processor='', args={gremlin=graph.compute(SparkGraphComputer).program(blvp).submit().get(), bindings={}, batchSize=64}}].
groovy.lang.MissingPropertyException: No such property: SparkGraphComputer for class: Script4
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
        at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
        at Script4.run(Script4.groovy:1)
        at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:619)
        at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:448)
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
        at org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.eval(ScriptEngines.java:119)
        at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$2(GremlinExecutor.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

我无法理解MissingPropertyException在groovy中的含义,它与java中的NoClassDefFound类似吗?

我相信服务器端缺少一些配置,有人可以帮我解决吗?

1 个答案:

答案 0 :(得分:2)

有两种方法可以解决这个问题。您只需在您要发送的脚本中导入SparkGraphComputer,或者可以将其添加到gremlin服务器的scriptEngines配置中。像

这样的东西
scriptEngines: {
  gremlin-groovy: {
    imports: [your.full.path.to.TheClass],
    staticImports: [your.full.path.to.TheClass.StaticVar]
   }
}