简体   繁体   中英

Cause of HotswapAgent org.hotswap.agent.command.ReflectionCommand Exception?

When making a change to my code, I encountered the following problem when trying to run HotswapAgent (1.3.0) with DCEVM (8u181) and Tomcat (7.0.62.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

What is the cause?

The cause of the problem was that Tomcat needs the com.sun.tools library, which can be obtained here: https://mvnrepository.com/artifact/com.sun/tools/1.7.0.13 .

By downloading and inserting tools-1.7.0.13.jar into the tomcat .../lib directory, and restarting tomcat then HotswapAgent seems to work as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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