javachronicle-map

Exception in ChronicleHashRecoveryFailedException: java.lang.UnsatisfiedLinkError: Can't find dependent libraries


I get the following error when I try to create a ChronicleMap:

Exception in thread "main" net.openhft.chronicle.hash.ChronicleHashRecoveryFailedException: java.lang.UnsatisfiedLinkError: C:\Users\sando\AppData\Local\Temp\jna-109203563\jna13551597900255569913.dll: Can't find dependent libraries
    at net.openhft.chronicle.map.ChronicleMapBuilder.openWithExistingFile(ChronicleMapBuilder.java:1877)
    at net.openhft.chronicle.map.ChronicleMapBuilder.createWithFile(ChronicleMapBuilder.java:1701)
    at net.openhft.chronicle.map.ChronicleMapBuilder.recoverPersistedTo(ChronicleMapBuilder.java:1655)
    at net.openhft.chronicle.map.ChronicleMapBuilder.createOrRecoverPersistedTo(ChronicleMapBuilder.java:1638)
    at net.openhft.chronicle.map.ChronicleMapBuilder.createOrRecoverPersistedTo(ChronicleMapBuilder.java:1629)
    at com.mycompany.app.App.createIndexOneFile(App.java:54)
    at com.mycompany.app.App.createIndexOne(App.java:31)
    at com.mycompany.app.App.main(App.java:23)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\sando\AppData\Local\Temp\jna-109203563\jna13551597900255569913.dll: Can't find dependent libraries
    at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
    at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
    at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
    at java.base/java.lang.Runtime.load0(Runtime.java:765)
    at java.base/java.lang.System.load(System.java:1834)
    at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:851)
    at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:826)
    at com.sun.jna.Native.<clinit>(Native.java:140)
    at net.openhft.chronicle.hash.impl.util.jna.WindowsMsync.<clinit>(WindowsMsync.java:34)
    at net.openhft.chronicle.hash.impl.VanillaChronicleHash.msync(VanillaChronicleHash.java:853)
    at net.openhft.chronicle.hash.impl.VanillaChronicleHash.msync(VanillaChronicleHash.java:841)
    at net.openhft.chronicle.map.ChronicleMapBuilder.commitChronicleMapReady(ChronicleMapBuilder.java:464)
    at net.openhft.chronicle.map.ChronicleMapBuilder.openWithExistingFile(ChronicleMapBuilder.java:1871)
    ... 7 more

Using this code:

String indexOnePath = "D:\\trabajo\\dbpedia\\dbpedia_files\\indexOne.bin";
        File indexOneFile = new File(indexOnePath);

        indexOne = ChronicleMap
                .of(String.class, String.class)
                .name("indexOne")
                .entries(27191196)
                .averageValue("<http://dbpedia.org/resource/Robert_Koch>")
                .averageKey("Battle of Ardrianople")
                .createOrRecoverPersistedTo(indexOneFile, true);

My pom.xml dependency looks like this:

<dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-map</artifactId>
            <version>3.19.4</version>
        </dependency>

I am using the Java SDK 11.0.6 on Windows 10.

It seems to create the file, but then the exception appears. If I use create insteaad of createOrRecoverPersistedTo, there seems to be no problem.


Solution

  • Latest released version of Chronicle-Map depends on fairly old jna version (4.2.1) which doesn't work well with recent Windows. You can try last snapshot version (3.19.5-SNAPSHOT) as we haven't released it yet, or try overriding jna version in maven, e.g. add this to your dependency-management section:

                <dependency>
                    <groupId>net.java.dev.jna</groupId>
                    <artifactId>jna</artifactId>
                    <version>5.5.0</version>
                </dependency>
    
                <dependency>
                    <groupId>net.java.dev.jna</groupId>
                    <artifactId>jna-platform</artifactId>
                    <version>5.5.0</version>
                </dependency>