简体   繁体   English

使用Java代理时出错

[英]Error while using java agent

I tried to build a profiler using http://www.ibm.com/developerworks/java/library/j-jip/ 我尝试使用http://www.ibm.com/developerworks/java/library/j-jip/构建探查器

One of my java applications when executed in command prompt 在命令提示符下执行时,我的Java应用程序之一

java -jar abc.jar 

gives required output, but when using a javaagent to profile the same application gives error 提供所需的输出,但是当使用javaagent来分析同一应用程序时会给出错误

java -javaagent:profiler.jar -jar abc.jar 

gives the following error 给出以下错误

Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at
branch target 20 in method 
()V at offset 12
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

But there are also some swing applications which is running fine with the above javaagent method. 但是也有一些swing应用程序可以通过上述javaagent方法正常运行。

Are you sure you are running your target JVM on JDK6? 您确定要在JDK6上运行目标JVM吗? JDK 7 tightened up the checks performed on stack map frames and this can lead to such VerifyError exceptions when the bytecode has been modified by tools unaware of these changes. JDK 7加强了在堆栈映射框架上执行的检查,当字节码已被不知道这些更改的工具修改时,这可能导致此类VerifyError异常。

Double check the target JVM and if you find you are using JDK 7 you can either switch to JDK 6 or use "-XX:-UseSplitVerifier" switch to change the verifier back to JDK 6 version. 仔细检查目标JVM,如果发现您正在使用JDK 7,则可以切换到JDK 6,也可以使用“ -XX:-UseSplitVerifier”开关将验证程序更改回JDK 6版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM