I'm trying to figure out how to connect to JanusGraph server from SpringBoot.
JanusGraph was setup with Cassandra and ElasticSearch to run in docker and as each instance of JanusGraph only serves one graph, I've updated gremlin-server.yaml to use ConfiguredGraphFactory so that it can dynamically add graphs on the server, following this guide https://jointhegraph.github.io/articles/hosting-multiple-graphs-on-janusgraph/.
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
ConfigurationManagementGraph: conf/janusgraph-hbase-configurationgraph.properties
}
The setup has been tested to be working with Gremlin-console and graphs are being created and persisted to Cassandra.
What I couldn't figure out is how to connect from SpringBoot app. I've tried using ConfiguredGraphFactory directly
graph = ConfiguredGraphFactory.getGraphNames().contains(xxx)
? ConfiguredGraphFactory.open(xxx)
: ConfiguredGraphFactory.create(xxx);
g = graph.traversal();
but it fails to connect to the JanusGraph server with the following error
java.lang.RuntimeException: org.janusgraph.graphdb.management.utils.ConfigurationManagementGraphNotEnabledException: Please add a key named "ConfigurationManagementGraph" to the "graphs" property in your YAML file and restart the server to be able to use the functionality of the ConfigurationManagementGraph class.
My guess is that the hostname/ip and port for JanusGraph server hasn't been specified but where and how can I set them using the JanusGraph classes?
I've checked the following but am still not getting it.
- https://docs.janusgraph.org/operations/configured-graph-factory/
- https://docs.janusgraph.org/interactions/connecting/java/
- https://www.javadoc.io/static/org.janusgraph/janusgraph-core/0.6.3/index.html?org/janusgraph/core/ConfiguredGraphFactory.html
Would anyone be able to help?
Appreciate and many thanks.