kowshik narayanam
kowshik narayanam

Reputation: 1

com.sun.tools.attach.AgentLoadException: 102 ( Java21 )

I am trying to attach an agent to the VM, something like this VirtualMachine vm = VirtualMachine.attach(pid); vm.loadAgent(agent_jar_path);

it throws an AgentLoadException with the status code 102. Stack trace :

Caused by: com.sun.tools.attach.AgentLoadException: 102
    at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.java:113) ~[jdk.attach:na]
    at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.java:124) ~[jdk.attach:na]
    at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:152) ~[jdk.attach:na]
    at jdk.attach/com.sun.tools.attach.VirtualMachine.loadAgent(VirtualMachine.java:538) ~[jdk.attach:na]
int rc = x.returnValue();
            switch (rc) {
                case JNI_ENOMEM:
                    throw new AgentLoadException("Insuffient memory");
                case ATTACH_ERROR_BADJAR:
                    throw new AgentLoadException(
                        "Agent JAR not found or no Agent-Class attribute");
                case ATTACH_ERROR_NOTONCP:
                    throw new AgentLoadException(
                        "Unable to add JAR file to system class path");
                case ATTACH_ERROR_STARTFAIL: ( 102 )
                    throw new AgentInitializationException(
                        "Agent JAR loaded but agent failed to initialize");
                default :
                    throw new AgentLoadException("" +
                        "Failed to load agent - unknown reason: " + rc);
            }

based on the primary investigation, understood that agent JAR is loaded but failed to initialize.

Could anyone please help me to fix this? Thanks.

Upvotes: 0

Views: 75

Answers (0)

Related Questions