Hello.
I've been trying to configure an embedded instance of Neo4J-4.0.1 using Kotlin via Gradle. Below, I have attached my code:
package ai.glue.me.trace
import org.neo4j.configuration.GraphDatabaseSettings
import org.neo4j.configuration.connectors.BoltConnector
import org.neo4j.configuration.helpers.SocketAddress
import org.neo4j.dbms.DatabaseManagementSystemSettings
import org.neo4j.dbms.api.DatabaseManagementService
import org.neo4j.dbms.api.DatabaseManagementServiceBuilder
import java.io.File
import java.nio.file.Paths
import java.util.*
object DBUtil {
private var runInit = false
private val queue = PriorityQueue<String>()
var dbService:DatabaseManagementService? = null
fun init(): DBUtil {
if (runInit) return this
val dbService = DatabaseManagementServiceBuilder(File("db/Trace"))
.setConfig(BoltConnector.enabled, true)
// .setConfig(DatabaseManagementSystemSettings.auth_store_directory, Paths.get("db/Trace/auth/"))
// .setConfig(GraphDatabaseSettings.data_directory, Paths.get("db/Trace/datadir/"))
.setConfig(GraphDatabaseSettings.neo4j_home, Paths.get("/"))
.setConfig(BoltConnector.listen_address, SocketAddress("localhost", 7687))
.build()
val graphDb = dbService.database("Trace")
this.dbService = dbService
runInit = true
return this //TODO change
//TODO load database, prepare queue for intake, print progress to console
}
/**
* Flush all queued transactions to the database, without closing the connection
*
* @return Boolean - If the flush was successful
*/
fun flush():Boolean {
return true
}
}
The init()
function is called from the main thread (not shown). The issue occurs when building the DatabaseManagementService
instance with .build()
, as the console returns this stack trace:
Error occurred while enabling Trace v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Can not resolve setting dependencies. ['unsupported.dbms.directories.auth'->'dbms.directories.data'] depend on settings not present in config, or are in a circular dependency
at org.neo4j.configuration.Config.evaluateSettingValues(Config.java:396) ~[?:?]
at org.neo4j.configuration.Config.<init>(Config.java:357) ~[?:?]
at org.neo4j.configuration.Config$Builder.build(Config.java:260) ~[?:?]
at org.neo4j.dbms.api.DatabaseManagementServiceBuilder.build(DatabaseManagementServiceBuilder.java:78) ~[?:?]
at ai.glue.me.trace.DBUtil.init(DBUtil.kt:28) ~[?:?]
I've searched the community as well as Google meticulously and haven't yet found anyone with this issue. From what I understand, it's an issue with the mentioned config settings not being set, although I have tried setting them. I've also tried copying the neo4j.conf
file shipped with the Neo4J-desktop zip (which is also installed to the same system) and copying it to a resources directory, then pointing to that, with no success. I have also repeated the same steps but with a /data/
directory, which is stated as being the default directory for config files.
I don't understand what I'm missing. I've tried many combinations of settings, directories, etc. I can only assume that I'm missing some settings that are marked as dependencies, but the stack trace isn't very clear on what is missing, or that there is indeed, somehow, a cyclic dependency.
I appreciate any help that I can be offered.