3 Replies Latest reply: Jul 24, 2007 2:20 AM by 800369 RSS

    Agent_Onload called twice?

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