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

Class loading breakage: Will not be able to instrument JDK classes #13

Closed
paulwbill opened this issue Sep 30, 2015 · 4 comments
Closed

Comments

@paulwbill
Copy link

I did everything as described on your Getting Started page.

$ uname -a
Linux sweden 3.5.7-03050732-generic #201403120653 SMP Wed Mar 12 10:54:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ javac -version
javac 1.8.0_45
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

$ javac -classpath allocation-jdk8.jar Test.java
$ java -javaagent:allocation-jdk8.jar Test
Class loading breakage: Will not be able to instrument JDK classes

I downloaded the latest java-allocation-instrumenter-3.0.jar and renamed to allocation-jdk8.jar.

Interestingly enough, this was working very fine with the previous allocation.jar for JDK7. But now I need to make it work for JDK8 as well.

I am lost here, can you give me some help.

Thanks!

@jhmanson
Copy link
Contributor

Keep it named java-allocation-instrumenter-3.0.jar. The JAR file contains metadata that makes the loading JVM put it on the bootclasspath, which is required to instrument JDK classes. The metadata has the name of the JAR file.

Alternatively, you can build from scratch and change in pom.xml to be whatever you want it to be.

@mzhaom
Copy link

mzhaom commented Jul 25, 2016

Looking at this issue again, I don't think it's a good idea to try to simplify the running process by hard coding the bootstrap classpath in the manifest file, because it's assuming the jar file is in the current working directory with a fixed name, which imposes unwritten constraints to the user and it's hard to follow. I would suggest just removing this file from the generated manifest file and update the document to let user specify -Xbootclasspath/a:allocation-instrumenter.jar just like specifying path in the -javaagent flag.

@mzhaom
Copy link

mzhaom commented Jul 25, 2016

s/removing this file/removing this line/

@jhmanson
Copy link
Contributor

There is nothing stopping the user from renaming it and adding the bootclasspath flag if they want to do so. This just provides them a way not to do so.

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

No branches or pull requests

3 participants