0

尝试创建 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

使用此代码:

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);

我的 pom.xml 依赖项如下所示:

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

我在 Windows 10 上使用 Java SDK 11.0.6。

似乎创建了文件,但随后出现异常。如果我使用 createOrRecoverPersistedTo 代替 create,似乎没有问题。

4

1 回答 1

0

最新发布的 Chronicle-Map 版本依赖于相当旧的 jna 版本(4.2.1),它不能很好地与最近的 Windows 配合使用。您可以尝试上一个快照版本(3.19.5-SNAPSHOT),因为我们还没有发布它,或者尝试在 maven 中覆盖 jna 版本,例如将其添加到您的依赖项管理部分:

            <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>
于 2020-05-10T13:20:25.377 回答