Agent_Onload called twice?

I have a C application which embeds a JVM (of course JNI). I'm trying to do some profiling with JVMTI.

Is there any reason Agent_OnLoad would be called twice during the start of the JVM? I'm only calling JNI_CreateJavaVM once in the application I am attempting to profile using JVMTI but the code in Agent_OnLoad is getting executed twice.

Thanks,

Troy

[380 byte] By [Cranberry_Lambica] at [2007-11-27 10:43:17]
# 1

It should not call twice. And I do not see how it can happen. If you

provide more information like how you called jni CreateJavaVm

would help to find out.

swamyva at 2007-7-28 19:59:22 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

I have many layers of architecture and a facility which handles parsing Java options on the behalf of my JNI applications. The agentpath option was getting set twice causing my agents to run twice. It has been my experience that the last Java option passed into the JVM overrides any prior instances of that particular option.I guess this is not true for agentlib or agentpath.

Hopefully tomorrow I'll find out that this conflict was the root cause of my JNI function Intercept issue I posted about earlier.

Cranberry_Lambica at 2007-7-28 19:59:22 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

There can be multiple -javaagent, -agentlib, -agentpath options on the command line as there may be multiple agents.

alan.batemana at 2007-7-28 19:59:22 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...