Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException jacoco #1

Closed
Nalha opened this issue Nov 21, 2019 · 3 comments
Closed

ClassNotFoundException jacoco #1

Nalha opened this issue Nov 21, 2019 · 3 comments

Comments

@Nalha
Copy link

@Nalha Nalha commented Nov 21, 2019

I have followed the steps in the readme multiple times but end up getting this exception, am I missing something obvious here?

java.lang.ClassNotFoundException: org.jacoco.agent.rt.RT
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at dev.fuzzit.javafuzz.core.Fuzzer.<init>(Fuzzer.java:25)
	at org.fuzzitdev.javafuzz.maven.FuzzGoal.execute(FuzzGoal.java:62)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
hello mojo
@yevgenypats
Copy link
Contributor

@yevgenypats yevgenypats commented Nov 22, 2019

Hey @Nalha :) Try the following to reproduce one of the examples:

docker run -it maven:3.6.2-jdk-11 /bin/bash
git clone https://github.com/fuzzitdev/javafuzz.git
cd javafuzz
mvn install
cd examples
wget -O jacocoagent.jar https://github.com/fuzzitdev/javafuzz/raw/master/javafuzz-maven-plugin/src/main/resources/jacocoagent-exp.jar
MAVEN_OPTS="-javaagent:jacocoagent.jar" mvn javafuzz:fuzz -DclassName=dev.fuzzit.javafuzz.examples.FuzzYaml

There were indeed a few typos in the tutorial. Thanks for pointing out. (specifcally it should be MAVEN_OPTS and not MAVEN_OPTIONS)

@Nalha Nalha closed this Nov 22, 2019
@Nalha
Copy link
Author

@Nalha Nalha commented Nov 22, 2019

Thanks, got it working now but I have some feedback if you're interested @yevgenypats

  1. It's named "core" in maven central, most others would use something like "javafuzz-core" as artifact id which makes a lot more sense when it shows up in reports etc.

  2. Your readme has the snapshot version in the dependency which isn't available in maven central.

  3. <plugin>...</plugins> is misspelled in the readme ;)

  4. The readme is ordered a bit strangely, you say "The first step is to implement the following function" before the dependency is even installed, its a minor thing but its nice if you can follow it step by step.

  5. It doesnt make much sense for AbstractFuzzTarget to be an abstract class when it doesnt have any code, use an interface so we can have inheritance in the test class if we wanted.

  6. The plugin step "fuzz" uses <phase>initialize</phase> which means it tries to run it before compile, which is a bit annoying if we're try to configure to run it in our pom.xml. I think the test phase makes more sense.

@yevgenypats
Copy link
Contributor

@yevgenypats yevgenypats commented Nov 23, 2019

Thanks for the detailed feedback! I'll try to implement those soon. Pull-Requests are welcomed as well:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.