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.

Unable to instrument class file version on Java 6 on JDK 11

See original GitHub issue

JDK: 11.0.2 Byte-Buddy: 1.10.1

Trying to instrument a certain library that was compiled in Java 6, it is being shown the following error:

java.lang.IllegalStateException: Cannot write invoke dynamic instruction for class file version Java 6

However, if I use JDK 1.7/1.8, the class is instrumented without problems.

Did I miss something to instrument these kind of classes? Thanks so very much!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
raphwcommented, Oct 16, 2019

I assume that you are using an advice template that uses an invokedynamic instruction, most likely a lambda expression. If your targeted class file was compiled against Java 6, it is illegal to inline such an expression into the instrumented class, no matter what JVM version you are running.

Make sure to compile your advice classes against Java 6 byte code level. That is the most universal to consider.

0reactions
drodriguezhdezcommented, Oct 16, 2019

Fixed!

Thanks for the support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix java.lang.UnsupportedClassVersionError
This error means that the JRE that is being used to execute your class code does not recognise the version of Java used....
Read more >
Java - Unsupported class file major version 61 - Mkyong.com
It means Java 17 (major version 61) compiled the class file, and if we try to run the class file under Java 16...
Read more >
How to Fix UnsupportedClassVersion Error in Java - Rollbar
The UnsupportedClassVersionError in Java occurs when the JVM attempts to read a malformed or otherwise erroneous class file.
Read more >
Android SDK with Java 11 - Mobile - New Relic Explorers Hub
Does the latest 6.0.0 version of the SDK work with JDK 11 when building on Android? I'm seeing this error: Error while instrumenting...
Read more >
Oracle JDK Migration Guide - Java
Before migrating your application to JDK 11, you should understand what the ... code on the class path with references to classes in...
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