HotswapAgent org.hotswap.agent.command.ReflectionCommand异常的原因?

时间:2019-06-12 16:19:12

标签: java tomcat dcevm hotswapagent

更改代码时,尝试在DCEVM(8u181)和Tomcat(7.0.62.0)上运行HotswapAgent(1.3.0)时遇到以下问题:

HOTSWAP AGENT: 17:03:34.936 ERROR (org.hotswap.agent.command.ReflectionCommand) - Error executin method hotswap in class org.hotswap.agent.plugin.hotswapper.HotswapperCommand
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.hotswap.agent.command.ReflectionCommand.doExecuteReflectionCommand(ReflectionCommand.java:189)
        at org.hotswap.agent.command.ReflectionCommand.executeCommand(ReflectionCommand.java:150)
        at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:25)
Caused by: java.lang.NoClassDefFoundError: com/sun/jdi/request/EventRequest
        at org.hotswap.agent.plugin.hotswapper.HotswapperCommand.hotswap(HotswapperCommand.java:30)
        ... 7 more
Caused by: java.lang.ClassNotFoundException: com.sun.jdi.request.EventRequest
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
        ... 8 more

是什么原因?

1 个答案:

答案 0 :(得分:0)

问题的原因是Tomcat需要com.sun.tools库,该库可从以下位置获取:https://mvnrepository.com/artifact/com.sun/tools/1.7.0.13

通过将tools-1.7.0.13.jar下载并插入到tomcat ... / lib目录中,然后重新启动tomcat,HotswapAgent似乎可以正常工作。