Issues to execute gremlin queries with Java versions higher than 11

I'm trying to perform gremlin queries in a Java 17 project and I'm receiving this error message:
Caused by: javax.script.ScriptException: java.util.concurrent.ExecutionException: BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy' Unsupported class file major version 61
Caused by: javax.script.ScriptException: java.util.concurrent.ExecutionException: BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy' Unsupported class file major version 61
I'm using these dependencies in my project:
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-core</artifactId>
<version>3.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-groovy</artifactId>
<version>3.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-core</artifactId>
<version>3.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-groovy</artifactId>
<version>3.6.1</version>
<scope>provided</scope>
</dependency>
Attached the stacktrace. Could someone help me with it?!
4 Replies
spmallette
spmallette•2y ago
Hello and welcome to the server. TinkerPop has had some problems upgrading Groovy given some performance issues that we've been having with newer versions. As a result we're not on a version that I believe runs nicely on jdk17. We're actively working on the problem now and have finally had some break-thru with the groovy community to solve the issue i believe the plan will be to have jdk17 support in 3.7.0. i'm not sure if we can easily backport the required changes to 3.5.x or 3.6.x you might be able to work around the problem though if you upgrade Groovy yourself and force the use of 3.x/4.x. the performance issue, as we've noted it, mostly pertains to the Gremlin Console so that has been an unfortunate blocker. if you were just using Gremlin Server/GremlinGroovyScriptEngine i dont think there's a problem the other alternative would be to avoid groovy all together since you are using 3.6.x you could try GremlinLangScriptEngine in Gremlin Server it uses the gremlin-language module which uses the Gremlin ANTLR grammar for parsing it's been noted to be as much as 5x faster than groovy, but it is not a direct drop in replacement it only processes Gremlin. you can't have Groovy related code in your scripts at all anyway, that's for the adventurous as GremlinLangScriptEngine is fairly new and not fully recommended yet your easiest approach would be to downgrade to jdk11 - then i'd expect everything to work out of the box nicely for you
maxdearruda
maxdearruda•2y ago
Hi @spmallette , I hope you're doing well! First of all, It's nice to e-meet you 🙂 So, let me introduce myself: I'm a contributor to the JNoSQL project, and we're using the TinkerPop library. That issue that I'm we're facing took me to talk to you! I've figured out that the gremlin-language is using the ANTLR 4.9.1 version. It's an old version. The newest version of this dependency is 4.12.0, and since the 4.10 version, new versions are no more compatible with the projects that used to use 4.9.x versions. Please, take a look here to get more detail about that: https://github.com/antlr/antlr4/releases It looks like this upgrade may help any project that is facing the same issue. Do you know if there's some plan to upgrade the TinkerPop project to use a newer ANTLR version?
GitHub
Releases · antlr/antlr4
ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. - antlr/antlr4
spmallette
spmallette•2y ago
ah...i recall now that antlr can create that sort of error. there were no particular plans to upgrade, but we could probably do it for 3.7.0. given the incompatibility issues with antlr it seems like it would be hard to do it in earlier versions. we also have other big dependency breaks in 3.7.0 coming so it would fit in. of course, the date for release of 3.7.0 is not for at least 3 months or so. i'm not sure what you can do in the mean time, short of preferring our version. i'd rather not shade antlr to gremlin-shaded as i think the goal should be to remove that dependency and not add more to it (a lot of folks dont like shaded jars).
maxdearruda
maxdearruda•2y ago
Thank you, @spmallette !!! I'm looking forward to the release of the 3.7.0 version!!!
Want results from more Discord servers?
Add your server