【问题标题】:Tinkerpop Gremlin Console: java.lang.NoSuchMethodError: org.apache.tinkerpop.gremlin.driver.RequestOptions$Builder.userAgentTinkerpop Gremlin 控制台:java.lang.NoSuchMethodError:org.apache.tinkerpop.gremlin.driver.RequestOptions$Builder.userAgent
【发布时间】:2020-08-31 18:18:17
【问题描述】:

作为我在403 Forbidden error for Gremlin to AWS Neptune 的最后一篇文章,我可以通过安装在我的EC2 实例上的Tinkerpop Gremlin 控制台v 3.4.3 成功连接到我的海王星集群数据库,因为https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth-connecting-gremlin-console.html 建议的v 3.4.1 不起作用对我来说。


         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/neptune-remote.yaml
==>Configured <my neptune>.cluster-cm<cluster id>.ap-southeast-2.neptune.amazonaws.com/<private ip>:8182
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [<my neptune>.cluster-cm<cluster id>.ap-southeast-2.neptune.amazonaws.com/<private ip>:8182] - type ':remote console' to return to local mode

但是,我在控制台上使用的所有 Gremlin 命令 (g.) 都出现 NoSuchMethodError 错误。

例如: g.V()

gremlin> g.V()
org.apache.tinkerpop.gremlin.driver.RequestOptions$Builder.userAgent(Ljava/lang/String;)Lorg/apache/tinkerpop/gremlin/driver/RequestOptions$Builder;
Type ':help' or ':h' for help.
Display stack trace? [yN]Y
java.lang.NoSuchMethodError: org.apache.tinkerpop.gremlin.driver.RequestOptions$Builder.userAgent(Ljava/lang/String;)Lorg/apache/tinkerpop/gremlin/driver/RequestOptions$Builder;
    at org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.send(DriverRemoteAcceptor.java:214)
    at org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.submit(DriverRemoteAcceptor.java:168)
    at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:110)
...

g.addV('person').property('name', 'justin')

gremlin> g.addV('person').property('name', 'justin')
org.apache.tinkerpop.gremlin.driver.RequestOptions$Builder.userAgent(Ljava/lang/String;)Lorg/apache/tinkerpop/gremlin/driver/RequestOptions$Builder;
Type ':help' or ':h' for help.
Display stack trace? [yN]Y
java.lang.NoSuchMethodError: org.apache.tinkerpop.gremlin.driver.RequestOptions$Builder.userAgent(Ljava/lang/String;)Lorg/apache/tinkerpop/gremlin/driver/RequestOptions$Builder;
    at org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.send(DriverRemoteAcceptor.java:214)
    at org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.submit(DriverRemoteAcceptor.java:168)
    at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:110)
....

我也尝试了最新的 Apache Tinkerpop Gremlin Console 3.4.6,同样的错误...

谢谢

【问题讨论】:

  • 您是否已将 SigV4WebSocketChannelizer 添加到您的 YAML 文件中?

标签: amazon-web-services gremlin tinkerpop3 amazon-neptune


【解决方案1】:

我认为您缺少的步骤是获取由您的 EC2 实例分配的 IAM 角色提供的临时凭证,并将其推送到默认凭证提供程序链中,以便 Gremlin 控制台使用的 SigV4Channelizer 可以看到它们。可以在此处查看该过程的高级概述:https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html

可以在此处找到为 Neptune 处理此问题的更规范的方法:https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth-temporary-credentials.html 请参阅标题为“为 Neptune IAM 身份验证设置 Amazon EC2”的部分。

【讨论】:

  • 您好 Taylor,我尝试使用“aws configure”来设置默认的 ec2 凭据,并尝试导出“AWS_xxx”环境变量。我什至尝试过使用两种类型的连接。 1) 到启用 IAM DB 的 Neptune 集群..(在 YAML 文件中使用 SigV4WebSocketChannelizer)。 2) 到没有启用 IAM DB 的 Neptune 集群(在 YAML 文件中使用 trustCertChainFile: SFSRootCAG2.pem)。不幸的是,两种连接方式都出现同样的错误
  • 我正在使用 Neptune 1.0.2.2.R2 引擎和 Gremlin 控制台 3.4.6
  • 很奇怪。您使用的是什么版本的 Java?确保您使用的是 Java 8。另请注意,在任何一种情况下都需要 trustCertChainFile(无论是否启用 IAM)。 pem 文件用于 SSL 证书验证。仅当启用 IAM 时才需要 SigV4WebSocketChannelizer。
  • 我无法重现此问题。除了您使用的 Java 版本之外,您还可以提供您在 EC2 实例上使用的操作系统版本吗?我正在使用带有 Java 8 和以下 yaml 文件的 Amazon Linux 2(最新版本):主机:[cluster.cluster-xxxxxxxx.us-west-2.neptune.amazonaws.com] 端口:8182 连接池:{ enableSsl:true , trustCertChainFile: "SFSRootCAG2.pem" } serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 } 我删除了: config: { serializeResultToString: true } 进行测试,它可以双向工作。
  • 我的 yaml 文件设置与您的类似,我使用的是 openjdk 版本“1.8.0_252”和最新的 Amazon Linux 2 AMI (HVM),SSD 卷类型 - ami-0970010f37c4f9c8d(64 位) x86) 在我的 ec2 实例上。
【解决方案2】:

我刚刚尝试使用 Gremlin 控制台 3.4.1,它按预期工作......我认为这是由于版本不兼容问题。我使用的是 Gremlin 控制台 3.4.6

【讨论】:

  • 很高兴你能成功。不过很奇怪,因为我们已经测试了 3.4.6 并且它运行良好。所以我想知道您的 3.4.6 安装中是否还有其他一些配置选项可能会导致一些问题。但是,是的,目前 Neptune 支持最高 3.4.3,但到目前为止我们还没有看到 3.4.6 控制台有任何问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多