tzaeschke / tinspin-indexes

Spatial index library with R*Tree, STR-Tree, Quadtree, CritBit, KD-Tree, CoverTree and PH-Tree
http://www.tinspin.org
Apache License 2.0
111 stars 24 forks source link

Caused by: java.lang.ClassNotFoundException: ch.ethz.globis.phtree.PhTreeF #25

Closed lpellegr closed 1 year ago

lpellegr commented 1 year ago

Using the last version (2.0.0) in a Java 20 app breaks as follows:

Exception in thread "main" java.lang.NoClassDefFoundError: ch/ethz/globis/phtree/PhTreeF at org.tinspin.index.phtree.PHTreeP.(PHTreeP.java:34) at org.tinspin.index.phtree.PHTreeP.create(PHTreeP.java:38) ... Caused by: java.lang.ClassNotFoundException: ch.ethz.globis.phtree.PhTreeF at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) Caused by: java.lang.ClassNotFoundException: ch.ethz.globis.phtree.PhTreeF

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 6 more

The dependency to tinspin is made via Gradle:

implementation 'org.tinspin:tinspin-indexes:2.0.0'

To reproduce, this simple code snippet is enough:

PHTreeP.create(2);

Adding the following dependency fixes the issue:

implementation 'ch.ethz.globis.phtree:phtree:2.8.0'

tzaeschke commented 1 year ago

Hi, thanks for reporting this! Any suggestion how I can fix this? The pom.xml in tinspin-indexes already has a public dependency for ch.ethz.globis.phtree. Not sure what else I can do...?

lpellegr commented 1 year ago

Thanks for your answer.

I am not sure about the reason but if you look at the pom file on Maven Central, it does not include the dependency to phtree with version 2.0.0 or 1.8.0:

https://repo1.maven.org/maven2/org/tinspin/tinspin-indexes/2.0.0/tinspin-indexes-2.0.0.pom https://repo1.maven.org/maven2/org/tinspin/tinspin-indexes/1.8.0/tinspin-indexes-1.8.0.pom

In version 1.7.1 the dependency was present: https://repo1.maven.org/maven2/org/tinspin/tinspin-indexes/1.7.1/tinspin-indexes-1.7.1.pom

So there is something in between 1.7.1 and 2.0.0 that changed. Maybe something with the release process?

tzaeschke commented 1 year ago

It appears the problem was triggered by updating the maven-shade-plugin from 3.2.4. to 3.4.1. Thinking about this, I believe the there should be no shading of dependencies in tinspin-indexes so I will remove the plugin.

lpellegr commented 1 year ago

Great that you have found the cause. Would it be possible to make a new release on Maven Central?

tzaeschke commented 1 year ago

I just released tinspin-indexes 2.0.1. Could you check whether it works now?

lpellegr commented 1 year ago

Thanks for the quick release, I confirm the issue is fixed with version 2.0.1.