Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-07-2021 12:18 PM
Hi Team,
we are using neo4j enterprise edition of 3.5.5 where we were trying to use apoc functionality but during execution we are only able to use apoc on default database. while we are using embedded database its not working and throwing below error:
"Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.custom.asProcedure
: Caused by: java.lang.NoClassDefFoundError: Could not initialize class apoc.util.JsonUtil"
apoc jar file present in both plugin folder for default and inside our binary.
we have tried many options but its not working. there are difference between jars present in plugin folder which is "apoc-3.5.0.3-all.jar" but while we are using maven its giving jar as "apoc-3.5.0.3.jar" which is bit strange.
We also registered all the apoc classes manually still its not able to resolve that error.
Code snippet as below:
graphDb = new EnterpriseGraphDatabaseFactory()
.newEmbeddedDatabaseBuilder(dbFile) //
// .loadPropertiesFromFile("/home/neo4j-enterprise-3.5.5/conf/neo4j.conf")
.setConfig(bolt.type, "BOLT")
.setConfig(bolt.enabled, "true")
// //.setConfig(bolt.address, dbHost + ":" + dbPort)
.setConfig(bolt.listen_address, dbHost + ":" + dbPort)
// .setConfig(GraphDatabaseSettings.plugin_dir,"/home/neo4j-enterprise-3.5.5/plugins/")
// .setConfig(GraphDatabaseSettings.procedure_unrestricted,"apoc.")
// .setConfig(GraphDatabaseSettings.procedure_whitelist,"apoc.")
.setConfig(udc_enabled, "false")
.newGraphDatabase();
public static void registerProcedure(GraphDatabaseService db, Class<?>...procedures) throws KernelException {
Procedures proceduresService = ((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(Procedures.class);
List<Class<?>> apocProcedures = asList(
Xml.class,
Coll.class,
Meta.class,
Date.class,
JsonUtil.class,
Json.class,
DBMS.class,
apoc.convert.Json.class,
apoc.version.Version.class,
apoc.help.Help.class,
apoc.text.Strings.class,
apoc.load.LoadJson.class,
apoc.util.JsonUtil.class,
PathExplorer.class,
GraphRefactoring.class,
apoc.periodic.Periodic.class,
apoc.load.Jdbc.class,
apoc.custom.CypherProcedures.class,
apoc.cypher.Cypher.class);
for (Class<?> procedure : apocProcedures) {
proceduresService.registerProcedure(procedure,true);
proceduresService.registerFunction(procedure, true);
proceduresService.registerAggregationFunction(procedure, true);
}
}
Below are version details:-
apoc.custom.asProcedure
: Caused by: java.lang.NoClassDefFoundError: Could not initialize class apoc.util.JsonUtilPlease help to resolve.
All the sessions of the conference are now available online