google / caliper

Micro-benchmarking library for Java
Apache License 2.0
816 stars 109 forks source link

Running a benchmark within its own jar files raises a ClassNotFoundException #309

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Clone and build

git clone https://code.google.com/p/caliper/
cd caliper
cd caliper ; mvn clean install ; cd ..
cd examples ; mvn clean install ; cd ..

2. Run DemoBenchmark

java -cp 
caliper/target/caliper-1.0-SNAPSHOT-all.jar:examples/target/caliper-examples-1.0
-SNAPSHOT.jar com.google.caliper.runner.CaliperMain examples.DemoBenchmark

What is the expected output? What do you see instead?

* Expected result: Benchmark should run successfully
* Seen result:

This selection yields 384 experiments.
64 experiments were skipped.
ERROR: Trial failed to complete (its results will not be included in the run):
  The worker exited without producing data. It has likely crashed. Inspect /var/folders/57/mgf2fxns26j3j9p9lnytdgxc0000gn/T/1430670138032-0/trial-2.log to see any worker output.

In /var/folders/57/mgf2fxns26j3j9p9lnytdgxc0000gn/T/1430670138032-0/trial-2.log:

[stderr] Exception in thread "main" java.lang.ClassNotFoundException: 
examples/DemoBenchmark
[stderr]        at java.lang.Class.forName0(Native Method)
[stderr]        at java.lang.Class.forName(Class.java:259)
[stderr]        at com.google.caliper.worker.WorkerMain.main(WorkerMain.java:67)

What version of the product are you using? On what operating system?

Version from Master at 2015-05-02

Please provide any additional information below.

If I pack the jars caliper-1.0-SNAPSHOT-all.jar and 
caliper-examples-1.0-SNAPSHOT.jar into one single jar, and run again from 
commandline, than the whole test does work.

Maybe related to https://code.google.com/p/caliper/issues/detail?id=246 ?

Original issue reported on code.google.com by jo.hil...@googlemail.com on 3 May 2015 at 4:25

phishman3579 commented 9 years ago

I am seeing the same problem. Any update or is there an older revision which works?

phishman3579 commented 9 years ago

I have fixed this problem in my fork and have added a pull request. https://github.com/google/caliper/pull/317