I am trying to fetch table metadata from Amazon Neptune using Neptune JDBC Driver. Our Neptune is IAM authentication enabled.
System.setProperty("aws.accessKeyId", AwsConstants.ACCESS_KEY);
System.setProperty("aws.secretKey", AwsConstants.SECRET_KEY);
System.setProperty("jdbc.drivers", "software.aws.neptune.NeptuneDriver");
String url = "jdbc:neptune:gremlin://" + AwsConstants.ENDPOINT;
Properties properties = new Properties();
properties.put("authScheme", "IAMSigV4");
properties.put("port", 8182);
properties.put("serviceRegion", AwsConstants.REGION);
properties.put("enableSsl", true);
properties.put("logLevel", "ALL");
connection = DriverManager.getConnection(url, properties);
List<String> vertex = new ArrayList<>();
List<String> edge = new ArrayList<>();
DatabaseMetaData metaData = connection.getMetaData();
ResultSet results = metaData.getTables(null, null, "%", null);
GremlinSchema gremlinSchema = MetadataCache.getGremlinSchema(AwsConstants.ENDPOINT);
SqlMetadata sqlMetadata = new SqlMetadata(gremlinSchema);
I have included below dependencies.
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-driver</artifactId>
<version>3.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-core</artifactId>
<version>3.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-groovy</artifactId>
<version>3.5.6</version>
</dependency>
<dependency>
<groupId>software.amazon.neptune</groupId>
<artifactId>amazon-neptune-jdbc-driver</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>amazon-neptune-sigv4-signer</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.1009</version>
</dependency>
For above set of jar, I am getting below exception.
Caused by: java.lang.ClassNotFoundException: org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
... 4 more
But if I add below dependency,
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>amazon-neptune-gremlin-java-sigv4</artifactId>
<version>2.4.0</version>
</dependency>
then getting below exception about NoSuchMehtod.
23/11/09 15:34:44 [gremlin-driver-loop-1] WARN channel.ChannelInitializer: Failed to initialize a channel. Closing: [id: 0x0289e5ec]
java.lang.NoSuchMethodError: org.apache.tinkerpop.gremlin.driver.handler.WebSocketClientHandler: method 'void <init>(io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker)' not found
at org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer.createHandler(SigV4WebSocketChannelizer.java:212)
at org.apache.tinkerpop.gremlin.driver.SigV4WebSocketChannelizer.configure(SigV4WebSocketChannelizer.java:176)
at org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:137)
at org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:83)
On the maven central, amazon-neptune-jdbc-driver jar with version 3.0.0 is present, but same exception is getting thrown even though I use 3.0.1 or 3.0.2 version jar.
Can someone help in identifying the issue?
There appears to be a conflict with some of your dependency versions.
SigV4WebSocketChannelizer
was the old method of handling IAM auth for gremlin. This Channelizer does not work with the latest versions of TinkerPop.My recommendation would be to try version 3.0.2 as this is the most up to date build, and use it with TinkerPop 3.6.4 if possible (this is the intended TP version for 3.0.2).
Let me know if TP 3.5.6 is required for other reasons and I can look for a resolution which includes it.