我成功將JavaSE8應用程序升級到ChronicleMap 3.14.1。 我有一個JavaEE7應用程序,它只是JavaSE8應用程序的一個外觀。JavaEE應用程序中的ChronicleMap問題
從JavaEE7調用創建chronicleMap的方法時,會引發一個錯誤。它看起來像「net.openhft.chronicle.hash.impl.util.jna.PosixMsync」未加載!
在JavaSE8應用程序中未提出此錯誤。
歡迎任何修正或建議。
在此先感謝。
java.lang.NoSuchFieldError: C_LIBRARY_NAME at net.openhft.chronicle.hash.impl.util.jna.PosixMsync.(PosixMsync.java:39) at net.openhft.chronicle.hash.impl.VanillaChronicleHash.msync(VanillaChronicleHash.java:878) at net.openhft.chronicle.hash.impl.VanillaChronicleHash.msync(VanillaChronicleHash.java:864) at net.openhft.chronicle.map.ChronicleMapBuilder.commitChronicleMapReady(ChronicleMapBuilder.java:417) at net.openhft.chronicle.map.ChronicleMapBuilder.createWithNewFile(ChronicleMapBuilder.java:1732) at net.openhft.chronicle.map.ChronicleMapBuilder.createWithFile(ChronicleMapBuilder.java:1589) at net.openhft.chronicle.map.ChronicleMapBuilder.recoverPersistedTo(ChronicleMapBuilder.java:1532) at net.openhft.chronicle.map.ChronicleMapBuilder.createOrRecoverPersistedTo(ChronicleMapBuilder.java:1515) at net.openhft.chronicle.map.ChronicleMapBuilder.createOrRecoverPersistedTo(ChronicleMapBuilder.java:1506) at net.openhft.chronicle.map.ChronicleMapBuilder.createOrRecoverPersistedTo(ChronicleMapBuilder.java:1500) at com.kem.ae.util.Utilities.mapBuilder(Utilities.java:125)
例外是在升高的:builder.createOrRecoverPersistedTo(MAPFILE);
public static <K, V> Map<K, V> mapBuilder(Class<K> key, Class<V> value, Param param, File mapFile) {
ChronicleMapBuilder<K, V> builder = ChronicleMapBuilder.of(key, value)
.entries(param.getTotalSeq());
if (key != Integer.class) {
builder = builder.averageKeySize(param.getEntrySize()
* (Exception.class.isAssignableFrom(value) ? 4 : 2));
}
if (value != Double.class) {
builder = builder.averageValueSize(param.getEntrySize()
* (Exception.class.isAssignableFrom(value) ? 4 : 2));
}
if (mapFile == null) {
// log.info("create in-memory off-heap map");
return builder.create();
} else {
try {
// log.info("create persisted off-heap map");
return builder.createOrRecoverPersistedTo(mapFile);
} catch (IOException ex) {
log.error(ex.getMessage(), ex);
return new ConcurrentHashMap<>();
}
}
}
試試這個在文件頂部:\t'static {System.setProperty(「jna.nosys」,「true」); }' –