Graph Data Science Failed to load library in my custom GRAPH Api function

I pulled the Graph Data Science package and organized it to create my custom functions. I developed my function and tested it. The algorithm test and procedure test(Call from cypher - I mean like algo and proc packages in GDS) both passed. Now I want to import my library into Neo4j.

In open-packaging module I excluded other packages and now shadowCopy command only produces a jar with only classes that I created.

The problem is that, when I examine debug.log during Neo4j initialization, I see an error saying 'Failed to load com.semanticspace.shortestpath.DijkstraMultiplePairs from plugin jar /var/lib/neo4j/plugins/semantic-space-gds-2.0.4.jar: org/neo4j/gds/shaded/com/carrotsearch/hppc/BitSet' (There is an import to this class in my class)

There are a lot of errors like that : having problem loading packages starting with 'org/neo4j/gds/shaded/'. So I modified the project to produce classes without 'org/neo4j/gds/shaded/' prefix, then again it 'fails to load'.

This class is also used in GDS Dijkstra method so I expect it resides in GDS jar at least. There are many others like that, maybe there is another prefix for these classes.

And when I call the function via Cypher it says 'Unable to inject component to field taskRegistryFactory, please ensure it is public and non-final: null'. It's probably because neo4j failed to load this class.

Can you tell me how should I import this kind of classes in my custom GDS functions?

UPDATE : So I figured that out that Neo4j expects from a package imported from within a package to reside in same jar. So I made it possible and now there is no 'Failed to error' is shown in the debug.log relating to my package.

Although in Cypher I still see the same error. And with the second call onwards, it's this : 'Unable to inject component to field taskRegistryFactory, please ensure it is public and non-final: Could not initialize class org.neo4j.gds.compat.Neo4jProxy'

I made the class non-final and it is public (Although the GDS functions are final). Still the same error.


I figured that out at last that it's related to Neo4j and GDS versions. So I reinstalled neo4j (4.4.7) and using GDS (2.0.4) and problem solved. I'm keeping the question because it points to some answers as well.