question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IllegalArgumentException from ASM

See original GitHub issue

Experiencing this issue when trying to Jib up the Groovy project at https://github.com/coollog/skaffold-code.one/tree/master/frontend-service

* What went wrong:
Execution failed for task ':jib'.
> java.lang.IllegalArgumentException (no error message)

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
...
Caused by: java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
        at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:64)
        at com.google.cloud.tools.jib.frontend.MainClassFinder$MainClassVisitor.<init>(MainClassFinder.java:123)
        at com.google.cloud.tools.jib.frontend.MainClassFinder$MainClassVisitor.<init>(MainClassFinder.java:111)
        at com.google.cloud.tools.jib.frontend.MainClassFinder.findMainClass(MainClassFinder.java:190)
        at com.google.cloud.tools.jib.frontend.MainClassFinder.find(MainClassFinder.java:161)
        at com.google.cloud.tools.jib.plugins.common.MainClassResolver.findMainClassInClassFiles(MainClassResolver.java:129)
        at com.google.cloud.tools.jib.plugins.common.MainClassResolver.resolveMainClass(MainClassResolver.java:61)
        at com.google.cloud.tools.jib.plugins.common.PluginConfigurationProcessor.computeEntrypoint(PluginConfigurationProcessor.java:278)
        at com.google.cloud.tools.jib.plugins.common.PluginConfigurationProcessor.processCommonConfiguration(PluginConfigurationProcessor.java:208)
        at com.google.cloud.tools.jib.plugins.common.PluginConfigurationProcessor.processCommonConfigurationForRegistryImage(PluginConfigurationProcessor.java:155)
        at com.google.cloud.tools.jib.gradle.BuildImageTask.buildImage(BuildImageTask.java:104)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at 
...

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
javiersiglercommented, Sep 29, 2019

I could solve this problem by adding the main class to the Manifest

Example:

jar {
    manifest {
        attributes 'Main-Class': 'com.package.HelloWorld'
    }
}
1reaction
chanseokohcommented, Mar 4, 2021

@MartijnDwars thanks for the feedback. Normally Gradle should pick up the most latest versions for dependencies when there are conflicts. However, we learned that it is a general and recurring issue in Gradle where an old version of a dependency is loaded in a multi-module Gradle project which leads to a frequent 'Method Not Found" or “Class Not Found” exception. The good news is that, with proper project configuration, this can be fixed, so in some sense, this is a Gradle configuration issue in your project. Check out this FAQ to learn more.

Or maybe the plugin could check the version of ASM that it runs with, and print an informative error message before the IllegalArgumentException that ASM produces.

Since this is a general Gradle configuration issue that can happen with any transitive dependencies of Jib (ASM happens to be the one here) and whose error can manifest in any unpredictable behavior (e.g., Method Not Found, or some behavior that works slightly differently, etc.), generally it doesn’t make much sense to increase Jib’s code complexity by adding a special handling for this particular IllegalArgummentException only for ASM. This is more or less out of the scope of Jib. However, if this particular error is frequent and consistent enough and many users keep running into it, it may not be unreasonable to try to catch this situation and return a helpful message. But for now, I think adding an FAQ entry is good enough. I’ll reopen this issue for tracking. Doc contributions are welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GWT application fails with IllegalArgumentException in org ...
asm :7.1 . Check that your project does not have a dependency on ASM that is earlier than 7. (Note that this could...
Read more >
PI96826: ILLEGALARGUMENTEXCEPTION IN ... - IBM
AnnotationConfigReader.getAnnota tionData(AnnotationConfigReader.java:883) : Caused by: java.lang.IllegalArgumentException at org.objectweb.asm.ClassReader.
Read more >
565254 – [java 14] java.lang.IllegalArgumentException ... - Bugs
Created attachment 283612 [details] LTW java 14 asm fails on readConst I recently upgraded my tycho project to java 14. I use LTWeaving...
Read more >
java.lang.IllegalArgumentException at org.objectweb.asm ...
IllegalArgumentException at org.objectweb.asm.ClassVisitor.<init>. 62 views ... IllegalArgumentException [INFO] at org.objectweb.asm.
Read more >
"java.lang.IllegalArgumentException" while running postInstall ...
This issue occurs due to a bug in the WAS libraries. The WAS class scanner cannot handle any jar files that have a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found