Manifest

Questions about YourKit Java Profiler
Post Reply
efecan
Posts: 2
Joined: Thu Jul 18, 2019 7:05 am

Manifest

Post by efecan »

Hi,

I am trying to use yourkit docker java profiler 2019.1.

I have followed the instructions to build my docker image with profiler, and it works as it is supposed to be. However, when application tries to read manifest file, which has been created by maven-jar-plugin, it reads manifest file of /tmp/yjp<date>.jar.

Is there any way to tell yourkit agent to save original manifest file?

YourKit Java Profiler (docker) : 2019.1
jdk: 1.8.0_181
os: Alpine Linux
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Manifest

Post by Anton Katilin »

Hello,

This seems an unknown issue. The JAR file /tmp/yjp<date>.jar contains profiler supporting Java classes, the profiler agent opens it but its manifest should not affect anything to my understanding.

How do you launch the profiled application? What is the command line?

Could you please send the profiler agent log file ~/.yjp/log/<session name>-<pid>.log to [email protected]

Best regards,
Anton
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Manifest

Post by Anton Katilin »

Update:
However, when application tries to read manifest file, which has been created by maven-jar-plugin, it reads manifest file of /tmp/yjp<date>.jar.
Does your application contain a code which explicitly reads the manifest, e.g. as a resource?

Normally, JAR file manifest is used for executable JARs to specify the entry point and other properties. The profiler's JAR in /tmp is not an executable JAR.
efecan
Posts: 2
Joined: Thu Jul 18, 2019 7:05 am

Re: Manifest

Post by efecan »

Thanks for fast reply,

Actually I have managed to access my manifest. I had been trying to reach first resource under "META-INF/MANIFEST.MF"

getClassLoader.getResourceAsStream("META-INF/MANIFEST.MF") -> this code finds the manifest of profiler agent jar in tmp directory.

But changing this line with this, getClassLoader().getResources("META-INF/MANIFEST.MF") and iterating over enumeration gives my desired manifest.

Command line,
java <some java options> -agentpath:<path to libyjpagent.so>,listen=all,delay=1000 -jar main.jar

Best regards,

Efecan
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Manifest

Post by Anton Katilin »

Hello Efecan,

So it's a classloading issue. The temp JAR is added to bootclasspath, so contributes the first resource by name.

Best regards,
Anton
Post Reply