0
votes

I am following the https://docs.janusgraph.org/basics/configured-graph-factory/#overview guide as I understand it.

I want to run the gremlin-server and setup a graph. I want to execute a groovy script on startup that opens or creates the graph and sets a schema for it. I am using Cassandra as a storage backend, starting it like so:

cassandra -fR

And the logs hum along nicely.

I use the provided config files, tweaking them according to the docs. My gremlin-server/gremlin-server.yaml is untouched, except for these lines:

channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
  ConfigurationManagementGraph: conf/gremlin-server/janusgraph-cassandra-es-server.properties
}

The contents of conf/gremlin-server/janusgraph-cassandra-es-server.properties are also untouched except for the following lines:

gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
storage.backend=cql
graph.graphname=ConfigurationManagementGraph
storage.hostname=127.0.0.1

And here is the startup script empty-sample.groovy

def globals = [:]
// defines a sample LifeCycleHook that prints some output to the Gremlin Server console.
// note that the name of the key in the "global" map is unimportant.
globals << [hook : [
        onStartUp: { ctx ->
            ctx.logger.info("Executed once at startup of Gremlin Server.")
        },
        onShutDown: { ctx ->
            ctx.logger.info("Executed once at shutdown of Gremlin Server.")
        }
] as LifeCycleHook]

Map map = new HashMap<String, Object>();
map.put("storage.backend", "cql");
map.put("storage.hostname", "127.0.0.1");
map.put("schema.default", "none");
map.put("graph.graphname", "test");
ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map));

JanusGraph jGraph = ConfiguredGraphFactory.open("test");

I then start the server like so:

$ bin/gremlin-server.sh conf/gremlin-server/gremlin-server.yaml

But I get an error telling me no Vertex label 'Configuration' exists. That feels like a schema=none issue, but I have not touched the schema.

8137 [gremlin-server-exec-1] ERROR org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager  - Could not create GremlinScriptEngine for gremlin-groovy
java.lang.IllegalStateException: javax.script.ScriptException: javax.script.ScriptException: java.lang.IllegalArgumentException: Vertex Label with given name does not exist: Configuration
    at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.lambda$createGremlinScriptEngine$16(DefaultGremlinScriptEngineManager.java:464)

EDIT

Lower down the stack trace, I also see this. This feels like I'm missing gremlin-groovy as a GremlinScriptEngine.

7535 [main] WARN  org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor  - Could not initialize gremlin-groovy GremlinScriptEngine as init script could not be evaluated
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: gremlin-groovy is not an available GremlinScriptEngine
    at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375)
    at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1947)
    at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.lambda$new$4(ServerGremlinExecutor.java:141)
    at java.util.LinkedHashMap$LinkedKeySet.forEach(LinkedHashMap.java:559)
    at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:136)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:122)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:86)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:345)
Caused by: java.lang.IllegalArgumentException: gremlin-groovy is not an available GremlinScriptEngine
    at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.registerLookUpInfo(CachedGremlinScriptEngineManager.java:95)
    at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.getEngineByName(CachedGremlinScriptEngineManager.java:58)
    at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:267)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Does any configuration wizard know how to fix this?

1

1 Answers

0
votes

I was able to fix this by dropping all the keyspaces I had previously made in Cassandra.

I probably made the ConfigurationManagementGraph with "schema.default"=none at some point.

The config I posted above should work on a fresh cassandra db.