0

3.0.0我正在尝试使用 Gremlin 控制台访问具有版本的远程 Gremlin 服务器3.0.0。我使用的序列化程序是GraphSONMessageSerializerV1d0.

当我运行它时,我收到一条错误消息:

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.sugar
plugin activated: tinkerpop.tinkergraph
plugin activated: aurelius.titan
gremlin> :remote connect tinkerpop.server conf/remote-json.yaml
==>Connected - localhost/127.0.0.1:8182
gremlin> :> graph.traversal().V(4128)

我收到此错误:

Server could not serialize the result requested. Server error - Error during serialization: (was java.lang.IllegalStateException) (through reference chain: java.util.ArrayList[0]->com.thinkaurelius.titan.graphdb.relations.RelationIdentifier["inVertexId"]). Note that the class must be serializable by the client and server for proper operation.
Display stack trace? [yN] y
org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException: Server could not serialize the result requested. Server error - Error during serialization: (was java.lang.IllegalStateException) (through reference chain: java.util.ArrayList[0]->com.thinkaurelius.titan.graphdb.relations.RelationIdentifier["inVertexId"]). Note that the class must be serializable by the client and server for proper operation.
    at org.apache.tinkerpop.gremlin.console.groovy.plugin.DriverRemoteAcceptor.submit(DriverRemoteAcceptor.java:110)
    at org.apache.tinkerpop.gremlin.console.commands.SubmitCommand.execute(SubmitCommand.groovy:41)
    at org.codehaus.groovy.tools.shell.Shell.execute(Shell.groovy:101)
    at org.codehaus.groovy.tools.shell.Groovysh.super$2$execute(Groovysh.groovy)
    at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130)
    at org.codehaus.groovy.tools.shell.Groovysh.executeCommand(Groovysh.groovy:254)
    at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:153)
    at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:119)
    at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:94)
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150)
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:123)
    at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:58)
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150)
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:82)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
    at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:134)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
    at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:292)
gremlin> 

控制台的配置文件是:

hosts: [localhost]
port: 8182
serializer:  { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 }

服务器是:

host: localhost
port: 8182
threadPoolWorker: 1
gremlinPool: 8
scriptEvaluationTimeout: 30000
serializedResponseTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph: conf/test_titan_isdb.properties}
plugins:
  - aurelius.titan
  - tinkerpop.tinkergraph
scriptEngines: {
  gremlin-groovy: {
    imports: [java.lang.Math],
    staticImports: [java.lang.Math.PI],
    scripts: [scripts/empty-sample.groovy]},
  nashorn: {
      imports: [java.lang.Math],
      staticImports: [java.lang.Math.PI]}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }                                             # application/vnd.gremlin-v1.0+gryo
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}   # application/vnd.gremlin-v1.0+gryo-stringd
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0 }                                  # application/vnd.gremlin-v1.0+json
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 }                                         # application/json
processors:
  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
metrics: {
  consoleReporter: {enabled: true, interval: 180000},
  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
  jmxReporter: {enabled: true},
  slf4jReporter: {enabled: true, interval: 180000},
  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
  graphiteReporter: {enabled: false, interval: 180000}}
threadPoolBoss: 1
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferHighWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
  enabled: false}
4

1 回答 1

2

在 gremlin-server.yaml 中,您需要包含序列化程序配置设置以使用 Titan 的映射器。查看titan-1.0.0-hadoop1.zip附带的gremlin-server.yaml

serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { useMapperFromGraph: graph }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { useMapperFromGraph: graph }}

之前在地图的 gremlin-server.yaml 中定义的对您的useMapperFromGraph关键引用。属性文件定义 TitanGraph,它使用自定义序列化程序。graphgraphs

graphs: {
  graph: conf/test_titan_isdb.properties}

您可以在 TinkerPop3 Gremlin 服务器文档中阅读有关此配置设置的更多信息。

于 2015-11-12T17:54:39.840 回答