Neo.ClientError.Procedure.ProcedureCallFailed Caused by java.lang.NoSuchMethodError 'org.roaringbitmap.Container org.roaringbitmap.ArrayContainer.add(char)')

neo4j version: 4.3.2
java version:

openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode)

maven version: 3.6.3

plugins:
We have two plugins in place apoc-4.2.0.0, and our custom plugin/stored-procedure (lets call it: com.company.procedure1).


An error is thrown while trying to use RoaringBitmap in a stored-procedure. Despite dependencies are correctly installed, and plugin in question compiles successfully, in execution time is showing this error because apparently a method doesn't exists.

Neo4jError: Failed to invoke procedure `com.company.procedure1`: Caused by: java.lang.NoSuchMethodError: 'org.roaringbitmap.Container org.roaringbitmap.ArrayContainer.add(char)')

There is an issue kind of related I found here ArrayContainer.add(char) error message on 0.9.0 but not on 0.8.20 · Issue #417 · RoaringBitmap/RoaringBitmap · GitHub , but apparently the cause was something different? The code that is throwing the exception in my case is:

import org.roaringbitmap.longlong.Roaring64Bitmap;
...
Roaring64Bitmap mybitmap = new Roaring64Bitmap();
...
for (int i = 0; i < nodesList.size(); i++) {
    mybitmap.add(((Node) nodesList.get(i)).getId()); // .getId() returns long values
}

This is how I have RoaringBitmap defined in pom.xml:

        <dependency>
            <groupId>org.roaringbitmap</groupId>
            <artifactId>RoaringBitmap</artifactId>
            <version>0.9.0</version>
        </dependency>

Also, I can see that two different versions are downloaded, included in maven repository org/roaringbitmap/RoaringBitmap: 0.7.17 and 0.9.0 .

And the way I'm importing is:

import org.roaringbitmap.longlong.Roaring64Bitmap;

Addendum:

This is happening in a new machine that was recently setup. But the weird thing is that this stored procedure is working fine in an older machine, having the same neo4j-java-maven versions. And in local using IntelliJ linking packages in the project, is not finding any offending code.

@pinox101

The problem doesn't seem present with apoc 4.3.0.4, so the easiest solution is to download and use it, from here.

Instead, if you need to use both the latest 4.3.x.x version and RoaringBitmap - 0.9.0,
you could download it from github and install it locally, that is:

git clone http://github.com/neo4j-contrib/neo4j-apoc-procedures
cd neo4j-apoc-procedures
git checkout 4.3

then in PROJECT_FOLDER/core/build.gradle
change version: '0.7.17' to version: '0.9.0',

and then execute in terminal:

./gradlew shadow

to create a .jar in PROJECT_FOLDER/full/build/libs folder.

1 Like

Yes, after applying a lot of other alternatives, I was able to do that, and it worked :). Thanks for the reply.

Note: I forked the repo, bump RoaringBitmap version to 0.9.0, push the changes, and then deploy the custom version of apoc 4.3 into neo4j plugins folder.

git clone http://github.com/YOUR_ORG/neo4j-apoc-procedures
cd neo4j-apoc-procedures
git checkout 4.3
./gradlew shadow
cp full/build/libs/apoc-4.3.0.5-all.jar /NEO4J_HOME/neo4j/plugins/
systemctl restart neo4j