cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Register or cal apoc.custom.asProcedure from embedded neo4j

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:-

  • neo4j version- 3.5.5 Enterprise edition
  • API / driver do you use- BOLT driver, apoc version-3.5.0.15
  • neo4j.log -
    Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.custom.asProcedure: Caused by: java.lang.NoClassDefFoundError: Could not initialize class apoc.util.JsonUtil

Please help to resolve.

0 REPLIES 0