为什么可以将顶点添加到 JanusGraph,但是向该顶点添加属性会抛出 SerializationException?

问题描述 投票:0回答:1

重现步骤:

  1. 使用默认配置启动JanusGraph服务器。(在\gremlin.bat中打开janusgraph-full-1.0.0)
  2. 使用Gremlin控制台连接到服务器。(打开janusgraph-full-1.0.0 in\gremlin-server.bat)
  3. 执行
    g.addV('person').next()
    成功添加无属性顶点。该命令执行成功,返回值为v[4208]。
  4. 尝试使用
    g.addV('person').property('name', 'Alice').property('age', 25).next()
    添加具有属性的顶点,这会导致序列化错误。

预期行为: 我希望添加具有属性的顶点,而不会遇到序列化问题。

环境: 操作系统:Microsoft Windows [v 10.0.19044.4170] Java版本:

openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment OpenLogic-OpenJDK (build 17.0.5+8-adhoc..jdk17u)
OpenJDK 64-Bit Server VM OpenLogic-OpenJDK (build 17.0.5+8-adhoc..jdk17u, mixed mode)

日志:

gremlin.bat

找不到文件

\\,,,/

(o o)

-----oOOo-(3)-oOOo-----

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in \[jar:file:/C:/janusgraph-full-1.0.0/lib/log4j-slf4j-impl-2.20.0.jar!/org/slf4j/impl/StaticLoggerBinder.class\]

SLF4J: Found binding in \[jar:file:/C:/janusgraph-full-1.0.0/lib/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class\]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

SLF4J: Actual binding is of type \[org.apache.logging.slf4j.Log4jLoggerFactory\]

plugin activated: tinkerpop.server

plugin activated: tinkerpop.tinkergraph

16:21:23 INFO org.apache.tinkerpop.gremlin.hadoop.jsr223.HadoopGremlinPlugin.getCustomizers - HADOOP\_GREMLIN\_LIBS is set to: C:\\janusgraph-full-1.0.0\\lib

16:21:23 WARN org.apache.hadoop.util.Shell.<clinit> - Did not find winutils.exe: java.io.FileNotFoundException: Could not locate Hadoop executable: C:\\Program Files\\hadoop-3.3.5\\bin\\winutils.exe -see https://wiki.apache.org/hadoop/WindowsProblems

16:21:23 WARN org.apache.hadoop.util.NativeCodeLoader.<clinit> - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

plugin activated: tinkerpop.hadoop

plugin activated: tinkerpop.spark

plugin activated: tinkerpop.utilities

plugin activated: janusgraph.imports

gremlin> :remote connect tinkerpop.server conf/remote-objects.yaml

4月 10, 2024 4:21:31 下午 org.yaml.snakeyaml.internal.Logger warn

警告: Failed to find field for org.apache.tinkerpop.gremlin.driver.Settings.serializers

16:21:32 INFO org.apache.tinkerpop.gremlin.driver.Connection.<init> - Created new connection for ws://localhost:8182/gremlin

16:21:32 INFO org.apache.tinkerpop.gremlin.driver.Connection.<init> - Created new connection for ws://localhost:8182/gremlin

16:21:32 INFO org.apache.tinkerpop.gremlin.driver.ConnectionPool.<init> - Opening connection pool on Host{address=localhost/127.0.0.1:8182, hostUri=ws://localhost:8182/gremlin} with core size of 2

==>Configured localhost/127.0.0.1:8182

gremlin> :remote console

==>All scripts will now be sent to Gremlin Server - \[localhost/127.0.0.1:8182\] - type ':remote console' to return to local mode

gremlin> g.V().count()

==>0

gremlin> g.addV('person').next()

==>v[4208]

gremlin> g.addV('person').property('name', 'Alice').property('age', 25).next()

Server could not serialize the result requested. Server error - Error during serialization: Serializer for type org.janusgraph.graphdb.relations.RelationIdentifier not found. Note that the class must be serializable by the client and server for proper operation.

Type ':help' or ':h' for help.

Display stack trace? \[yN\]

gremlin>

gremlin-server.bat

找不到文件
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/janusgraph-full-1.0.0/lib/log4j-slf4j-impl-2.20.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/janusgraph-full-1.0.0/lib/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.GremlinServer.printHeader - 3.7.0
         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----

4月 10, 2024 4:21:20 下午 org.yaml.snakeyaml.internal.Logger warn
警告: Failed to find field for org.apache.tinkerpop.gremlin.server.Settings.plugins
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.GremlinServer.main - Configuring Gremlin Server from C:\janusgraph-full-1.0.0\conf\gremlin-server\gremlin-server.yaml
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager.addConsoleReporter - Configured Metrics ConsoleReporter configured with report interval=180000ms
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager.addCsvReporter - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager.addJmxReporter - Configured Metrics JmxReporter configured with domain= and agentId=
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.util.MetricManager.addSlf4jReporter - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
16:21:20 INFO  org.apache.commons.beanutils.FluentPropertyBeanIntrospector.introspect - Error when creating PropertyDescriptor for public final void org.apache.commons.configuration2.AbstractConfiguration.setProperty(java.lang.String,java.lang.Object)! Ignoring this property.
16:21:20 INFO  org.janusgraph.diskstorage.configuration.builder.ReadConfigurationBuilder.setupTimestampProvider - Set default timestamp provider MICRO
16:21:20 INFO  org.janusgraph.graphdb.idmanagement.UniqueInstanceIdRetriever.getOrGenerateUniqueInstanceId - Generated unique-instance-id=a9fe536b27460-UAZ3ZAEY1
16:21:20 INFO  org.janusgraph.diskstorage.configuration.ExecutorServiceBuilder.buildFixedExecutorService - Initiated fixed thread pool of size 32
16:21:20 INFO  org.janusgraph.graphdb.database.StandardJanusGraph.<init> - Gremlin script evaluation is disabled
16:21:20 INFO  org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller.initializeTimepoint - Loaded unidentified ReadMarker start time 2024-04-10T08:21:20.896778Z into org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller@44b18fe4
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init> - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
16:21:20 INFO  org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init> - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.lambda$new$4 - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.lambda$new$8 - A GraphTraversalSource is now bound to [g] with graphtraversalsource[standardjanusgraph[inmemory:[127.0.0.1]], standard]
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.op.OpLoader.lambda$static$0 - Adding the standard OpProcessor.
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.op.OpLoader.lambda$static$0 - Adding the session OpProcessor.
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.op.OpLoader.lambda$static$0 - Adding the traversal OpProcessor.
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$start$1 - Executing start up LifeCycleHook
16:21:22 INFO  org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache - Executed once at startup of Gremlin Server.
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.GremlinServer.createChannelizer - idleConnectionTimeout was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.GremlinServer.createChannelizer - keepAliveInterval was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.AbstractChannelizer.lambda$configureSerializers$4 - Configured application/vnd.gremlin-v2.0+json with org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV2
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.AbstractChannelizer.lambda$configureSerializers$4 - Configured application/json with org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV2
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.AbstractChannelizer.lambda$configureSerializers$4 - Configured application/vnd.graphbinary-v1.0 with org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1
16:21:22 INFO  org.apache.tinkerpop.gremlin.server.AbstractChannelizer.lambda$configureSerializers$4 - Configured application/vnd.graphbinary-v1.0-stringd with org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1
16:21:23 INFO  org.apache.tinkerpop.gremlin.server.GremlinServer$1.operationComplete - Gremlin Server configured with worker thread pool of 1, gremlin pool of 16 and boss thread pool of 1.
16:21:23 INFO  org.apache.tinkerpop.gremlin.server.GremlinServer$1.operationComplete - Channel started at port 8182.
16:21:40 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx$3.execute - Query requires iterating over all vertices [[]]. For better performance, use indexes
16:21:54 INFO  org.janusgraph.graphdb.relations.RelationIdentifier.<clinit> - Use default relation delimiter: -
16:21:54 WARN  org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.makeFrame - The result [[v[4272]]] in the request 56aef62a-c531-45f0-81ef-529f5b682e12 could not be serialized and returned.
org.apache.tinkerpop.gremlin.util.ser.SerializationException: java.io.IOException: Serializer for type org.janusgraph.graphdb.relations.RelationIdentifier not found
        at org.apache.tinkerpop.gremlin.util.ser.binary.ResponseMessageSerializer.writeValue(ResponseMessageSerializer.java:86) ~[gremlin-util-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1.serializeResponseAsBinary(GraphBinaryMessageSerializerV1.java:155) ~[gremlin-util-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.makeFrame(AbstractOpProcessor.java:289) ~[gremlin-server-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:168) ~[gremlin-server-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$6(AbstractEvalOpProcessor.java:267) ~[gremlin-server-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:283) ~[gremlin-groovy-3.7.0.jar:3.7.0]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.io.IOException: Serializer for type org.janusgraph.graphdb.relations.RelationIdentifier not found
        at org.apache.tinkerpop.gremlin.structure.io.binary.TypeSerializerRegistry.validateInstance(TypeSerializerRegistry.java:411) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.TypeSerializerRegistry.getSerializer(TypeSerializerRegistry.java:380) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:90) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.VertexPropertySerializer.writeValue(VertexPropertySerializer.java:62) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.VertexPropertySerializer.writeValue(VertexPropertySerializer.java:36) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.writeValue(SimpleTypeSerializer.java:91) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.write(SimpleTypeSerializer.java:73) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:112) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.CollectionSerializer.writeValue(CollectionSerializer.java:52) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.ListSerializer.writeValue(ListSerializer.java:44) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.ListSerializer.writeValue(ListSerializer.java:29) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.writeValue(SimpleTypeSerializer.java:91) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.write(SimpleTypeSerializer.java:73) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:112) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.VertexSerializer.writeValue(VertexSerializer.java:62) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.VertexSerializer.writeValue(VertexSerializer.java:39) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.writeValue(SimpleTypeSerializer.java:91) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.write(SimpleTypeSerializer.java:73) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:112) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.CollectionSerializer.writeValue(CollectionSerializer.java:52) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.ListSerializer.writeValue(ListSerializer.java:44) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.ListSerializer.writeValue(ListSerializer.java:29) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.writeValue(SimpleTypeSerializer.java:91) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer.write(SimpleTypeSerializer.java:73) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter.write(GraphBinaryWriter.java:112) ~[gremlin-core-3.7.0.jar:3.7.0]
        at org.apache.tinkerpop.gremlin.util.ser.binary.ResponseMessageSerializer.writeValue(ResponseMessageSerializer.java:84) ~[gremlin-util-3.7.0.jar:3.7.0]
        ... 11 more
hadoop gremlin janusgraph gremlin-server
1个回答
0
投票

我通过将第一个配置更改为第二个配置解决了问题。

\janusgraph-full-1.0。

© www.soinside.com 2019 - 2024. All rights reserved.