Saturday, December 5, 2015

JMH - ERROR: Unable to find the resource: /META-INF/BenchmarkList

I tried to use micro benchmarking tool called JMH. It look really nice. I used it for speed verification of my B+Tree implementation. It's at https://github.com/jajir/jblinktree. I'm using eclipse for building project and after some time I met following exception:

Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to find the resource: /META-INF/BenchmarkList
	at org.openjdk.jmh.runner.AbstractResourceReader.getReaders(AbstractResourceReader.java:96)
	at org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:104)
	at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:228)
	at org.openjdk.jmh.runner.Runner.run(Runner.java:178)
	at com.coroptis.jblinktree.performance.MapTestRunner.main(MapTestRunner.java:75)

Problem is that class BenchmarkList didn't find file '/META-INF/BenchmarkList'. This file contains list of precompiled benchmark tests. This file was missing because I compile project form eclipse and not from maven. Solution is compile project from command link:

mvn clean install

And from now it's work fine. If you have problem to configure JMH in maven look at https://github.com/jajir/jblinktree/blob/master/benchmark/pom.xml.