问题标签 [javaagents]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 将 javaagent 与 Junit 一起使用会导致 Class.forName 中出现 ClassNotFoundException
结果是:
但:
结果是:
核心问题似乎是:
抛出 ClassNotFoundException 如下:
我不知道为什么它找不到课程。请注意,检测代理已成功加载并且不会引发任何异常。
java - 如何在不停止 JVM 的情况下将 Javaagent 添加到 JVM?
我希望在不停止应用程序的情况下分析 Java 应用程序。我可以在应用程序运行时以某种方式添加 Javaagent 吗?
java - 如何将 vm 选项添加到码头?
如何指定像-javaagent这样的 vm 选项来启动码头,或者它只能通过 MAVEN_OPTS 变量使用?我需要它来启用方面的加载时间编织。这个插件好像不行。
也许可以通过jetty-plugin来完成,但是它的标签systemProperties说
不会覆盖已在命令行或 JVM 上设置的系统属性
这是什么意思?
java - javaagent jar 在 bootclasspath 中的位置
我有一个 javaagent jar,我使用它放在 bootclasspath 上
在 MANIFEST.MF 文件中。
我需要找出 jar 所在文件系统上的目录。
然而,这里描述的方法似乎对我不起作用:
在这种情况下,ProtectionDomain.getCodeSource() 返回 null。我猜这是因为 jar 已被放在引导类路径中。因此,我也无法执行 MyClass.getClassLoader() 来获取资源位置。
我正在使用 Java 6。
谁能告诉如何获得罐子的位置?
java - 如何测试 ClassFileTransformer / javaagent?
我ClassFileTransformer
使用 ASM 为 javaagent 实现了一个。因为它有一些bug,所以我想为它写一个JUnit测试用例。我该怎么做呢?
使用我认为的伪代码:
现在的问题是:我如何手动加载和转换主题并让 JVM/Classloader 使用我操纵的版本?还是我完全错过了什么?
java - 将 -javaagent 添加到 Tomcat 6 服务器,我将它放在哪里以及以什么格式?
我正在尝试安装一个可以监视 J2EE Web 事务的应用程序运行状况监视应用程序,我需要以某种方式将 javaagent 放入我的 Tomcat 中,但不清楚具体如何执行此操作,我使用的是 Linux,并且已得到软件的指示制造此产品的公司执行以下操作:
我从他们那里得到了进一步的支持,他们基本上说将其放入适当的 .sh 文件中(但他们无法告诉我哪个文件适用于 Tomcat)
我尝试将它放在 catalina.sh 文件中,但它似乎不起作用:
任何建议表示赞赏
java - 如何诊断导致 NullPointerException 的字段/方法
假设您的 Java 代码如下所示:
并且您在该行上得到一个 NullPointerException。你怎么知道哪个是空的?您可以调试它并检查每个调用,或者您可以暂时将链接拆分为多行。
但是,我记得不久前看到一个开源项目,它可以运行,我认为它是一个 javaagent,它可以为 NullPointerException 提供更好的堆栈跟踪,它提供返回 null 结果的方法调用。不幸的是,我似乎找不到它。有谁知道那将如何完成,或者它是什么工具?
java - 如何创建 jvmti 代理以查看所有加载的类、对象及其字段详细信息
我想编写一个 java 代理来检测一些应用程序。我有兴趣获取应用程序实例化的对象(即它们的字段)的详细信息。我还想在运行时捕获对任何这些对象/它们的字段的任何读写访问。
您能否指导我编写代理,让我知道我应该探索哪些类和方法。我只知道 java.lang.instrument 类。但我在那里找不到任何可以捕捉这些事件的东西。
我也对您认为可以帮助我的任何其他 Java 检测技术持开放态度。
java - How do I catch the read and writes in a java program?
I am trying to create a tool that can capture all the read and writes made by a java program. Also, I would like to know what fields of what object is access/modified.
I currently looked at:-
1) java.lang.instrument I could not do much with that. I could not understand how to write an agent that can get access to the a running program and create a watch on different objects/fields and anything related. I would appreciated if you have any idea or information on that.
2) jvmti I looked at jvmti and tried to create a jvmti tool, but I figured out that to get the objects, I would need the JVMTI_EVENT_OBJECT_ALLOC be a potential capability. But, I figured that, it is not. Moreover, I read that this event is not called for new command. Hence, at the moment, even this does not seem applicable.
So, I would like to know if you guys know any way to do what I want to do, either using the above mentioned methods or any other technique/tool that you may be aware of?
NOTE: I do not have access to the source code of the application. All, I have are the class files.
java - JVM 可以通过附加 api 检索已加载到其中的代理列表吗?
是否可以通过 Java 1.6 attach api 获取加载到当前 JVM 中的代理列表?如果有怎么办?
启动时加载的代理可以通过 RuntimeMXBean 确定,但我看不到一种方法来处理启动后添加的代理。