javaagents

Slf4j loggers with Byte Buddy

谁说胖子不能爱 提交于 2019-12-11 15:49:01
问题 I try to instrument a java class called ThreadPoolExecutor and i want to get details of threads using slf4j loggers and I am getting following error Exception in thread "pool-2-thread-2" Exception in thread "pool-2-thread-1" java.lang.NoClassDefFoundError: com/github/shehanperera/threadagent/MonitorInterceptor at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java) at java.lang.Thread.run(Thread.java:748)java.lang.NoClassDefFoundError: com/github/shehanperera

Play 2.1 / taking in account a javaagent while running tests

人走茶凉 提交于 2019-12-11 12:08:40
问题 My goal is to launch my integration tests contained within my Play app. To do so, I used to launch them through Intellij. Those tests needs Spring aspectJ weaving, thus I precised in my Intellij test conf this VM argument: -javaagent:/Users/myName/.ivy2/cache/org.springframework/spring-instrument/jars/spring-instrument-3.2.2.RELEASE.jar The whole works. Now I want to be able to launch them through command-line using the simple play command following by test-only command. First I read this

JDI, Java Byte code instrumentation and Java agents (JWDP, JVMTI)

一笑奈何 提交于 2019-12-11 04:38:17
问题 I am new in the realm of debuggers, instrumentation and JVMTI. So I have few questions about them. What is the difference between JDI(java debugger interface), JWDP, javaagent and native agent(JVMTI). and where does the java instrumentation API fit in picture. I am using JDI to intercept exceptions in target java application. but I found out that JDI is not good enough if we talk about how it impacts the performance of target app. I read that most good applications does this with combining

How to create a jvmti agent to see all the loaded classes, objects and their field details

回眸只為那壹抹淺笑 提交于 2019-12-11 03:04:00
问题 I want to write a java agent to instrument some applications. I am interested in getting the details of the objects, (i.e. their fields) instantiated by the applications. I would also like to catch any read and write access to any of those objects/their fields while running. Can you please guide me in writing the agents and let me know what classes and methods should I explore. I just know about java.lang.instrument class. But I could not find anything there that could catch these events. I

Can a JVM retrieve a list of agents that have been loaded into it via the attach api?

╄→гoц情女王★ 提交于 2019-12-10 03:04:04
问题 Is it possible to get a list of agents loaded into the current JVM by the Java 1.6 attach api? If so how? Agents loaded at launch can be determined via RuntimeMXBean but I can't see a way to get a handle on ones added after launch. 回答1: No, I don't think there is a portable way to find out about the agents. What are you trying to accomplish? Maybe there is another approach... 回答2: (This question is similar to How to find list of java agents attached with a running JVM?. For the sake of

Unable to instrument apache httpclient using javaagent for spring boot uber jar application

a 夏天 提交于 2019-12-09 23:06:03
问题 I'm trying to write a javaagent with Bytebuddy to intercept apache httpclient requests and I want to use this agent for spring boot application. The agent works fine when I start my test spring boot application from Idea (run the main method directly). However, when I package the application into a spring boot uber jar and run it using java -javaagent:myagent.jar -jar myapplication.jar , it throws the following exception. onError:org.apache.http.impl.client.AbstractHttpClient java.lang

Getting a list of all JADE containers

谁说胖子不能爱 提交于 2019-12-09 22:35:02
问题 I want to get a list of all containers in the current platform. This question is similar, but the answer is obsolete and the method is by querying to the AMS agent. Is there any simpler way out than to communicate via ACL messages which I think is complex, there should be a way out to get a simple list of containers. Thanks for your help 回答1: You can achieve this by using the AMSSubscriber class and listen to the events when a container is added or removed. See sample code below: public class

C++ jump to other method execution

馋奶兔 提交于 2019-12-09 14:52:45
问题 In my C++ JNI-Agent project i am implementing a function which would be given a variable number of parameters and would pass the execution to the other function: // address of theOriginalFunction public static void* originalfunc; void* interceptor(JNIEnv *env, jclass clazz, ...){ // add 4 to the function address to skip "push ebp / mov ebp esp" asm volatile("jmp *%0;"::"r" (originalfunc+4)); // will not get here anyway return NULL; } The function above needs to just jump to the: JNIEXPORT

Can a JVM retrieve a list of agents that have been loaded into it via the attach api?

无人久伴 提交于 2019-12-05 04:08:55
Is it possible to get a list of agents loaded into the current JVM by the Java 1.6 attach api? If so how? Agents loaded at launch can be determined via RuntimeMXBean but I can't see a way to get a handle on ones added after launch. No, I don't think there is a portable way to find out about the agents. What are you trying to accomplish? Maybe there is another approach... (This question is similar to How to find list of java agents attached with a running JVM? . For the sake of completeness, I will add this answer to both questions.) Checking agents that have been added using the Attach API: If

Getting a list of all JADE containers

こ雲淡風輕ζ 提交于 2019-12-04 19:07:44
I want to get a list of all containers in the current platform. This question is similar, but the answer is obsolete and the method is by querying to the AMS agent. Is there any simpler way out than to communicate via ACL messages which I think is complex, there should be a way out to get a simple list of containers. Thanks for your help You can achieve this by using the AMSSubscriber class and listen to the events when a container is added or removed. See sample code below: public class myAgent extends Agent { private ArrayList<ContainerID> availableContainers = new ArrayList<ContainerID>();