Using JQF plugin 2.0-SNAPSHOT
sohah opened this issue · 5 comments
Hi,
I want to use new JQF jars from 2.0-SNAPSHOT. So, I execute mvn package
, then use mvn install
to install the new jars with version 2.0-SNAPSHOT
into my local maven. More precisely, I install jqf-plugin
, jqf-instrument
, jqf-fuzz
with version 2.0-SNAPSHOT
into my local maven, i.e., into .m2
.
Now, things work well, and I am able to compile and build, but when I try to run the new plugin from JQF plugin2.0-SNAPSHOT. I am getting
java.lang.NoClassDefFoundError: edu/berkeley/cs/jqf/instrument/InstrumentingClassLoader
.
This problem goes away if I revert back to using the 1.9 JQF plugin but keep the other dependencies with 2.0-SNAPSHOT version.
As far as I can tell, the plugin is just an entry point, and it will use the newer dependencies of JQF, i.e., 2.0-SNAPSHOT. So, I guess that won't be a problem as I am not trying to change the plugin in itself, though I am not sure why I am getting this problem and whether there is any workaround to it.
Any insights about what is going on? Is this a bug in the newer plugin, or is there something that I am missing?
Many thanks!
Hmm, that's strange. I have not run into this issue but I can try to see if I can reproduce it. In the meanwhile, can you simply start from a clean slate by deleting everything under .m2/repository/edu/berkeley/cs/jqf
and just installing only the 2.0-SNAPSHOT? I am not sure if Maven plugins have a preference for non-SNAPSHOT versions of dependencies.
Another thing to try is to use --debug
when running the mvn jqf:fuzz
command. It should print a list of dependencies that Maven is resolving as follows:
[DEBUG] edu.berkeley.cs.jqf:jqf-maven-plugin:jar:2.0-SNAPSHOT
[DEBUG] org.apache.maven:maven-plugin-api:jar:3.5.3:compile
[DEBUG] .... (many lines)
...
[DEBUG] edu.berkeley.cs.jqf:jqf-instrument:jar:2.0-SNAPSHOT:compile
[DEBUG] org.ow2.asm:asm:jar:9.1:compile (version managed from default)
[DEBUG] edu.berkeley.cs.jqf:jqf-fuzz:jar:2.0-SNAPSHOT:compile
[DEBUG] junit:junit:jar:4.13.1:compile (version managed from default)
This may help you debug if the plugin is expecting a different dependency (e.g. jqf-instrument:jar:1.9) for InstrumentingClassLoader
.
Thanks for the quick reply. I'm getting more details using the debug option. Here is the error, and below that is the stack backtrace.
I'm going to try to debug it further, I need to get it working, using version 1.9 for the plugin while keeping other jars being 2.0-SNAPSHOT, didn't seem to be working either. So, I'm back at this problem. Note that in .m2 I could see that the installed jar clearly has the InstrumentingClassLoader
.
Any insight about what or how I can debug this problem it is much appreciated!
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>edu.berkeley.cs.jqf:jqf-maven-plugin:2.0-SNAPSHOT
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/soha/.m2/repository/edu/berkeley/cs/jqf/jqf-maven-plugin/2.0-SNAPSHOT/jqf-maven-plugin-2.0-SNAPSHOT.jar
[ERROR] urls[1] = file:/home/soha/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : edu.berkeley.cs.jqf.instrument.InstrumentingClassLoader
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal edu.berkeley.cs.jqf:jqf-maven-plugin:2.0-SNAPSHOT:fuzz (default-cli) on project serverless: Execution default-cli of goal edu.berkeley.cs.jqf:jqf-maven-plugin:2.0-SNAPSHOT:fuzz failed: A required class was missing while executing edu.berkeley.cs.jqf:jqf-maven-plugin:2.0-SNAPSHOT:fuzz: edu/berkeley/cs/jqf/instrument/InstrumentingClassLoader
-----------------------------------------------------```
The stack backtrace is:
`[DEBUG] Configuring mojo edu.berkeley.cs.jqf:jqf-maven-plugin:2.0-SNAPSHOT:fuzz from plugin realm ClassRealm[plugin>edu.berkeley.cs.jqf:jqf-maven-plugin:2.0-SNAPSHOT, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@55054057]
[WARNING] Error injecting: edu.berkeley.cs.jqf.plugin.FuzzGoal
java.lang.NoClassDefFoundError: edu/berkeley/cs/jqf/instrument/InstrumentingClassLoader
at java.lang.Class.getDeclaredConstructors0 (Native Method)
at java.lang.Class.privateGetDeclaredConstructors (Class.java:3137)
at java.lang.Class.getDeclaredConstructors (Class.java:2357)
at com.google.inject.spi.InjectionPoint.forConstructorOf (InjectionPoint.java:243)
at com.google.inject.internal.ConstructorBindingImpl.create (ConstructorBindingImpl.java:115)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding (InjectorImpl.java:717)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding (InjectorImpl.java:941)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive (InjectorImpl.java:863)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding (InjectorImpl.java:300)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow (InjectorImpl.java:231)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow (InjectorImpl.java:1084)
at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1116)
at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1078)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1131)
at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57)
at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127)
at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1094)
at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:520)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)`
You can easily reproduce this error by following these steps:
- clone zest-example
- clone JQF
- build JQF using
mvn package
- change
zest-example/pom.xml
to use<version>2.0-SNAPSHOT</version>
instead of<version>1.8</version>
for both<artifactId>jqf-fuzz</artifactId>
and<artifactId>jqf-maven-plugin</artifactId>
- install the new compiled JQF jars into local maven using the set of commands below
rm -fr ~/.m2/repository/edu/berkeley/
printf " installing JQF 2.0-SNAPSHOT into local maven .m2\n"
mvn install:install-file -o \
-Dfile=$root_dir/JQF/maven-plugin/target/jqf-maven-plugin-2.0-SNAPSHOT.jar \
-DgroupId=edu.berkeley.cs.jqf \
-DartifactId=jqf-maven-plugin \
-Dversion=2.0-SNAPSHOT \
-Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
mvn install:install-file -o \
-Dfile=$root_dir/JQF/instrument/target/jqf-instrument-2.0-SNAPSHOT.jar \
-DgroupId=edu.berkeley.cs.jqf \
-DartifactId=jqf-instrument \
-Dversion=2.0-SNAPSHOT \
-Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
mvn install:install-file -o \
-Dfile=$root_dir/JQF/fuzz/target/jqf-fuzz-2.0-SNAPSHOT.jar \
-DgroupId=edu.berkeley.cs.jqf \
-DartifactId=jqf-fuzz \
-Dversion=2.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
mvn install:install-file \
-Dfile=$root_dir/JQF/fuzz/target/jqf-fuzz-2.0-SNAPSHOT-zest-cli.jar \
-DgroupId=edu.berkeley.cs.jqf \
-DartifactId=jqf-fuzz-zest-cli \
-Dversion=2.0-SNAPSHOT \
-Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
- run JQF using
mvn jqf:fuzz -Dclass=examples.PatriciaTrieTest -Dmethod=testMap2Trie -Dtime=1m -Dblind
Thanks for the details! I was able to repro the issue.
Can you tell me why you are installing individual JARs instead of just running mvn install
in the JQF repository to install all the 2.0-SNAPSHOT artifacts? When I do this I am able to use jqf-maven-plugin
version 2.0-SNAPSHOT from the jqf-zest-example
repo. From a quick diff in .m2
, I believe it has to do with installing the parent POM of the jqf
module (which contains fuzz
, instrument
, maven-plugin
, etc.).
That worked! Thank you for helping out.
I think mvn install
is cleaner than what I was doing. It just didn't come naturally to me, I felt the urge to install every jar, but it looks like that was missing the overall pom structure. Perhaps updating the documentation would make it easier for future users.
Many thanks. I'll close this issue now.