3 Replies Latest reply on Jul 24, 2007 7:20 AM by alanb

    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.

        • 1. Re: Agent_Onload called twice?
          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.
          • 2. Just an FYI
            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.
            • 3. Re: Just an FYI
              There can be multiple -javaagent, -agentlib, -agentpath options on the command line as there may be multiple agents.