I've encountered the following exception in an application that is being built with Gradle and uses AspectJ. The app works fine when started from within Eclipse but fails to start once built with Gradle:
Caused by: java.lang.AssertionError: java.lang.ClassNotFoundException: net.openhft.chronicle.hash.VanillaGlobalMutableState$$Native
at net.openhft.chronicle.values.ValueModel.createClass(ValueModel.java:313) ~[chronicle-values-1.0.3-alpha.jar!/:na]
at net.openhft.chronicle.values.ValueModel.createNativeClass(ValueModel.java:286) ~[chronicle-values-1.0.3-alpha.jar!/:na]
at net.openhft.chronicle.values.ValueModel.nativeClass(ValueModel.java:268) ~[chronicle-values-1.0.3-alpha.jar!/:na]
at net.openhft.chronicle.values.Values.nativeClassFor(Values.java:51) ~[chronicle-values-1.0.3-alpha.jar!/:na]
at net.openhft.chronicle.values.Values.newNativeReference(Values.java:38) ~[chronicle-values-1.0.3-alpha.jar!/:na]
at net.openhft.chronicle.hash.impl.VanillaChronicleHash.createGlobalMutableState(VanillaChronicleHash.java:324) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.hash.impl.VanillaChronicleHash.initOwnTransients(VanillaChronicleHash.java:373) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.hash.impl.VanillaChronicleHash.initTransients(VanillaChronicleHash.java:369) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.VanillaChronicleMap.initTransients(VanillaChronicleMap.java:146) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.VanillaChronicleMap.<init>(VanillaChronicleMap.java:102) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.ChronicleMapBuilder.newMap(ChronicleMapBuilder.java:1703) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.ChronicleMapBuilder.lambda$createWithFile$93(ChronicleMapBuilder.java:1449) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.ChronicleMapBuilder$$Lambda$7/78866071.fileIOAction(Unknown Source) ~[na:na]
at net.openhft.chronicle.map.ChronicleMapBuilder.lambda$fileLockedIO$92(ChronicleMapBuilder.java:182) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.ChronicleMapBuilder$$Lambda$8/862681096.apply(Unknown Source) ~[na:na]
at java.util.concurrent.ConcurrentHashMap.compute(Unknown Source) ~[na:1.8.0_45]
at net.openhft.chronicle.map.ChronicleMapBuilder.fileLockedIO(ChronicleMapBuilder.java:179) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.ChronicleMapBuilder.createWithFile(ChronicleMapBuilder.java:1447) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
at net.openhft.chronicle.map.ChronicleMapBuilder.createPersistedTo(ChronicleMapBuilder.java:1400) ~[chronicle-map-3.5.0-rc.jar!/:3.5.0-rc]
In my build.gradle I have:
compile "net.openhft:chronicle-map:3.5.0-rc"
I've also tried this with earlier versions, without success.
One thing I have noticed when starting from Eclipse is that this new warning shows up when Chronicle is fist accessed:
warning: Supported source version 'RELEASE_7' from annotation processor 'org.neo4j.kernel.impl.annotations.ServiceProcessor' less than -source '1.8'
warning: Supported source version 'RELEASE_7' from annotation processor 'org.neo4j.kernel.impl.annotations.DocumentationProcessor' less than -source '1.8'
but I am not sure if that is related. Am I missing some other dependency?
Edit: I should also mentioned that I use Spring and that my Chronicle map is instantiated as part of a Spring bean.
Edit 2: Debug logging didn't yield anything useful. I'll try to downgrade to an older version of chronicle map next.
Edit 3: It works when building with
compile "net.openhft:chronicle-map:2.4.12"
Edit 4: Same error with new 3.6.0-rc
Edit 5: I have
compile files(org.gradle.internal.jvm.Jvm.current().getToolsJar())
in my build.gradle in order to add the tools.jar (Gradle doesn't have provide afaik). It is also part of the resulting (fat) jar file that I start.
Chronicle Map version 3.7.0-rc
doesn't have this issue. It emits some no-harm warnings, which will go away with the next released version.