Comments (6)
Author: Chris Newland <[email protected]>
Date: Mon Jan 4 23:05:26 2021 +0000
Fix JavapTask fallback for JDK17 reflection failure (module system)
Yep, the binary release was on 2020-10-29 so it doesn't include this fix.
I agree my commit was a hack and that the correct module system fix is better.
Let me try your suggestion!
Thanks for reporting and contributing :)
from jitwatch.
Bingo! That works :)
I'll commit the pom fix and then after some testing I'll create some new binaries.
Many thanks Thiago!
from jitwatch.
Hi @Thihup hmm, I put in a catch so that it should fallback to JavapProcess (a ProcessBuilder wrapper around the JDK/bin/javap executable) if the reflection attempt fails.
Please can you let me know what OS and JDK you are using (and are you using the latest JITWatch built from source?)
Cheers,
Chris
from jitwatch.
Hi @chriswhocodes. I'm using Linux and JDK 18, but since JDK 16 this exception happens.
I'm using the 1.4.0-shaded.jar version, but I can try building it from the source too.
I think if it is possible to add the manifest attribute, it should be a little faster in the JVMs that support that manifest attribute.
from jitwatch.
OK, I updated the shade plugin config to
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>project-classifier</shadedClassifierName>
<outputFile>target/ui-shaded.jar</outputFile>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${main.class}</mainClass>
<manifestEntries>
<Add-Exports-Private>jdk.jdeps/com.sun.tools.javap</Add-Exports-Private>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
which gives me a MANIFEST.MF of
chris@aurora:~/IdeaProjects/jitwatch/ui/target$ more META-INF/MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.6.0
Built-By: chris
Build-Jdk: 17
Main-Class: org.adoptopenjdk.jitwatch.launch.LaunchUI
Add-Exports-Private: jdk.jdeps/com.sun.tools.javap
which looks OK but when I run the jar:
chris@aurora:~/IdeaProjects/jitwatch$ /home/chris/jdk-17/bin/java -jar ui/target/ui-shaded.jar
and then run JITWatch I still get the fallback to ProcessBuilder:
21:30:11.582 [Thread-3] INFO o.a.j.l.BytecodeLoader - Could not fetch bytecode via reflection, trying Process
21:30:11.583 [Thread-3] INFO o.a.j.p.r.RuntimeJava - JavapProcess() executablePath: /home/chris/jdk-17/bin/javap
Any ideas?
from jitwatch.
From the JEP [1], the manifest attribute is Add-Exports
instead of Add-Exports-Private
. Could you give it a try?
[1] https://openjdk.java.net/jeps/261#Packaging:-Modular-JAR-files
from jitwatch.
Related Issues (20)
- how to set config for openjdk built by source files HOT 11
- I can't see the assembly instructions. HOT 2
- Fix gradle build to find FreeLogJ HOT 1
- Fix code cache visualisation since segmented code cache
- Fix auxiliary scripts which assume local lib folder HOT 1
- hsdis download failed on x86 mac HOT 2
- JITWatch shows garbled characters HOT 5
- After the SpringBoot project adds source and class to the config, the following error occurs when you click start HOT 5
- NPE occured from Tag.getAttributes() HOT 3
- The button in the tool is garbled HOT 2
- NPE on "Chain" button HOT 11
- java.lang.VerifyError: Cannot inherit from final class HOT 2
- compile ok but see nothing
- Unable to see source code for project classes as well as java lang classes HOT 11
- Gradle build is broken. HOT 2
- Add compilation flags HOT 3
- Add JMH in Sandbox HOT 1
- Any plans to support the Vector API? HOT 4
- tableswitch and Method size HOT 4
- Support for Azul Prime
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jitwatch.