Open ZeeJJ123 opened 3 weeks ago
@returnToInnocence
To resolve the java.lang.AssertionError
indicating that 'gremlin-groovy is not an available GremlinScriptEngine' when running GremlinApiTests
on HugeGraph, follow these steps:
Ensure Dependencies: Add the gremlin-groovy
dependency to your pom.xml
:
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-groovy</artifactId>
<version>3.4.10</version> <!-- Use the appropriate version -->
</dependency>
Check Configuration: Verify that the gremlin-groovy
script engine is correctly configured in your HugeGraph server configuration. Ensure that the gremlin-groovy
script engine is listed in the scriptEngines
configuration in gremlin-server.yaml
:
scriptEngines: {
gremlin-groovy: {
plugins: {
org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
classImports: [
java.lang.Math,
org.apache.hugegraph.backend.id.IdGenerator,
org.apache.hugegraph.type.define.Directions,
org.apache.hugegraph.type.define.NodeRole,
org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser,
org.apache.hugegraph.traversal.algorithm.CountTraverser,
org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,
org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,
org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
org.apache.hugegraph.traversal.algorithm.HugeTraverser,
org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
org.apache.hugegraph.traversal.algorithm.KneighborTraverser,
org.apache.hugegraph.traversal.algorithm.KoutTraverser,
org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,
org.apache.hugegraph.traversal.algorithm.PathsTraverser,
org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,
org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,
org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,
org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,
org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,
org.apache.hugegraph.traversal.algorithm.steps.EdgeStep,
org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,
org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,
org.apache.hugegraph.traversal.optimize.Text,
org.apache.hugegraph.traversal.optimize.TraversalUtil,
org.apache.hugegraph.util.DateUtil
],
methodImports: [java.lang.Math#*]
},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
files: [scripts/empty-sample.groovy]
}
}
}
}
Initialize Script Engine: Ensure that the script engine is initialized properly in your test setup. You might need to explicitly initialize the gremlin-groovy
script engine before running the tests:
import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
import javax.script.ScriptEngineManager;
public class GremlinApiTest extends BaseApiTest {
static {
// Initialize the GremlinGroovyScriptEngine
ScriptEngineManager manager = new ScriptEngineManager();
manager.registerEngineName("gremlin-groovy", new GremlinGroovyScriptEngine());
}
// Your test methods
}
Set Language in GremlinRequest: Ensure that your GremlinRequest
class in GremlinAPI
is correctly setting the language to gremlin-groovy
:
public static class GremlinRequest implements Checkable {
@JsonProperty
private String gremlin;
@JsonProperty
private Map<String, Object> bindings = new HashMap<>();
@JsonProperty
private String language = "gremlin-groovy";
@JsonProperty
private Map<String, String> aliases = new HashMap<>();
// Other methods...
}
By ensuring that the gremlin-groovy
dependency is included, the script engine is properly initialized and configured, and the GremlinRequest
class is correctly set up, you should be able to resolve the java.lang.AssertionError
and run your GremlinApiTests
successfully [1].
To continue talking to Dosu, mention @dosu.
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label
Problem Type (问题类型)
server status (启动/运行异常)
Before submit
Environment (环境信息)
Your Question (问题描述)
After successfully deploying HugeGraph server and HugeGraph-Hubble, I encountered errors while running GremlinApiTests and attempting to create a graph. The system reported a java.lang.AssertionError with a status of 400. The error message indicates that 'gremlin-groovy is not an available GremlinScriptEngine', which seems to stem from a configuration issue or missing dependency.
Error Details: java.lang.AssertionError: Response with status 400 and content: {"exception":"java.lang.IllegalArgumentException", "message":"gremlin-groovy is not an available GremlinScriptEngine", "cause":"[java.lang.IllegalArgumentException]"} Expected: 200 Actual: 400
Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response