HotswapProjects / HotswapAgent

Java unlimited redefinition of classes at runtime.
GNU General Public License v2.0
2.36k stars 493 forks source link

[Tomcat 9] InvocationTargetException in transform method on plugin 'class org.hotswap.agent.plugin.tomcat.TomcatPlugin' #388

Open edward-p opened 3 years ago

edward-p commented 3 years ago
/home/edward/Data/Cache/tomcat9/bin/catalina.sh run
Connected to the target VM, address: '127.0.0.1:34135', transport: 'socket'
[2021-01-20 12:17:00,486] Artifact Gradle : xyz.edward_p : SpringMVC-1.0-SNAPSHOT.war (exploded): Waiting for server connection to start artifact deployment...
HOTSWAP AGENT: 12:17:00.523 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.4.1} - unlimited runtime class redefinition.
HOTSWAP AGENT: 12:17:01.287 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [JdkPlugin, Hotswapper, WatchResources, ClassInitPlugin, AnonymousClassPatch, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Omnifaces, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, GlassFish, Vaadin, Wicket, CxfJAXRS, FreeMarker, Undertow, MyBatis]
20-Jan-2021 12:17:02.279 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name:   Apache Tomcat/9.0.41
20-Jan-2021 12:17:02.280 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jan 9 1970 03:59:56 UTC
20-Jan-2021 12:17:02.280 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.41.0
20-Jan-2021 12:17:02.280 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
20-Jan-2021 12:17:02.281 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            5.10.8-zen1-1-zen
20-Jan-2021 12:17:02.281 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
20-Jan-2021 12:17:02.281 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-8-openjdk-dcevm/jre
20-Jan-2021 12:17:02.281 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_232b09-201911100919-dcevm8u232b09
20-Jan-2021 12:17:02.281 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
20-Jan-2021 12:17:02.281 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /home/edward/.cache/JetBrains/IntelliJIdea2020.3/tomcat/9bdfa3d4-2f34-49f4-bf0f-3d7a6a1d02ef
20-Jan-2021 12:17:02.281 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /mnt/data/edward/Cache/tomcat9
20-Jan-2021 12:17:02.282 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/edward/.cache/JetBrains/IntelliJIdea2020.3/tomcat/9bdfa3d4-2f34-49f4-bf0f-3d7a6a1d02ef/conf/logging.properties
20-Jan-2021 12:17:02.282 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
20-Jan-2021 12:17:02.282 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:34135,suspend=y,server=n
20-Jan-2021 12:17:02.282 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/opt/intellij-idea-ultimate-edition/plugins/java/lib/rt/debugger-agent.jar
20-Jan-2021 12:17:02.282 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/opt/intellij-idea-ultimate-edition/plugins/Groovy/lib/agent/gragent.jar
20-Jan-2021 12:17:02.282 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/home/edward/Data/Cache/hotswap-agent/hotswap-agent-1.4.1.jar
20-Jan-2021 12:17:02.282 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
20-Jan-2021 12:17:02.283 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
20-Jan-2021 12:17:02.302 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
20-Jan-2021 12:17:02.302 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.password.file=/home/edward/.cache/JetBrains/IntelliJIdea2020.3/tomcat/9bdfa3d4-2f34-49f4-bf0f-3d7a6a1d02ef/jmxremote.password
20-Jan-2021 12:17:02.302 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.access.file=/home/edward/.cache/JetBrains/IntelliJIdea2020.3/tomcat/9bdfa3d4-2f34-49f4-bf0f-3d7a6a1d02ef/jmxremote.access
20-Jan-2021 12:17:02.302 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
20-Jan-2021 12:17:02.303 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
20-Jan-2021 12:17:02.303 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
20-Jan-2021 12:17:02.303 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
20-Jan-2021 12:17:02.303 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
20-Jan-2021 12:17:02.303 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/edward/.cache/JetBrains/IntelliJIdea2020.3/tomcat/9bdfa3d4-2f34-49f4-bf0f-3d7a6a1d02ef
20-Jan-2021 12:17:02.304 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/edward/Data/Cache/tomcat9
20-Jan-2021 12:17:02.304 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/edward/.cache/JetBrains/IntelliJIdea2020.3/tomcat/9bdfa3d4-2f34-49f4-bf0f-3d7a6a1d02ef/temp
20-Jan-2021 12:17:02.309 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
20-Jan-2021 12:17:02.631 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
20-Jan-2021 12:17:02.669 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [876] milliseconds
20-Jan-2021 12:17:02.712 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
20-Jan-2021 12:17:02.712 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.41]
20-Jan-2021 12:17:02.738 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
20-Jan-2021 12:17:02.762 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [92] milliseconds
Connected to server
[2021-01-20 12:17:03,199] Artifact Gradle : xyz.edward_p : SpringMVC-1.0-SNAPSHOT.war (exploded): Artifact is being deployed, please wait...
HOTSWAP AGENT: 12:17:03.363 ERROR (org.hotswap.agent.annotation.handler.PluginClassFileTransformer) - InvocationTargetException in transform method on plugin 'class org.hotswap.agent.plugin.tomcat.TomcatPlugin' class 'org/apache/catalina/webresources/StandardRoot'.
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.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:218)
    at org.hotswap.agent.annotation.handler.PluginClassFileTransformer.transform(PluginClassFileTransformer.java:112)
    at org.hotswap.agent.util.HotswapTransformer.transform(HotswapTransformer.java:246)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at org.apache.catalina.core.StandardContext.startInternal(Unknown Source)
    at org.apache.catalina.util.LifecycleBase.start(Unknown Source)
    at org.apache.catalina.core.ContainerBase.addChildInternal(Unknown Source)
    at org.apache.catalina.core.ContainerBase.addChild(Unknown Source)
    at org.apache.catalina.core.StandardHost.addChild(Unknown Source)
    at org.apache.catalina.startup.HostConfig.manageApp(Unknown Source)
    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.apache.tomcat.util.modeler.BaseModelMBean.invoke(Unknown Source)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(Unknown Source)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(Unknown Source)
    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.apache.tomcat.util.modeler.BaseModelMBean.invoke(Unknown Source)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
    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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.hotswap.agent.javassist.CannotCompileException: [source error] no such field: path
    at org.hotswap.agent.javassist.CtBehavior.insertBefore(CtBehavior.java:806)
    at org.hotswap.agent.javassist.CtBehavior.insertBefore(CtBehavior.java:766)
    at org.hotswap.agent.plugin.tomcat.WebappLoaderTransformer.patchStandardRoot(WebappLoaderTransformer.java:148)
    ... 66 more
Caused by: compile error: no such field: path
    at org.hotswap.agent.javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:873)
    at org.hotswap.agent.javassist.compiler.TypeChecker.atFieldRead(TypeChecker.java:831)
    at org.hotswap.agent.javassist.compiler.TypeChecker.atMember(TypeChecker.java:1017)
    at org.hotswap.agent.javassist.compiler.JvstTypeChecker.atMember(JvstTypeChecker.java:76)
    at org.hotswap.agent.javassist.compiler.ast.Member.accept(Member.java:42)
    at org.hotswap.agent.javassist.compiler.JvstTypeChecker.atMethodArgs(JvstTypeChecker.java:235)
    at org.hotswap.agent.javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:763)
    at org.hotswap.agent.javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:723)
    at org.hotswap.agent.javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:170)
    at org.hotswap.agent.javassist.compiler.ast.CallExpr.accept(CallExpr.java:49)
    at org.hotswap.agent.javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:266)
    at org.hotswap.agent.javassist.compiler.CodeGen.atDeclarator(CodeGen.java:771)
    at org.hotswap.agent.javassist.compiler.ast.Declarator.accept(Declarator.java:103)
    at org.hotswap.agent.javassist.compiler.CodeGen.atStmnt(CodeGen.java:381)
    at org.hotswap.agent.javassist.compiler.ast.Stmnt.accept(Stmnt.java:53)
    at org.hotswap.agent.javassist.compiler.Javac.compileStmnt(Javac.java:578)
    at org.hotswap.agent.javassist.CtBehavior.insertBefore(CtBehavior.java:786)
    ... 68 more

HOTSWAP AGENT: 12:17:03.591 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.tomcat.TomcatPlugin' initialized in ClassLoader 'ParallelWebappClassLoader
  context: springmvc
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@543295b0
'.
HOTSWAP AGENT: 12:17:03.591 INFO (org.hotswap.agent.plugin.tomcat.TomcatPlugin) - Tomcat plugin initialized - Tomcat version '9.0.41.0'

InvocationTargetException was throwed, but org.hotswap.agent.plugin.tomcat.TomcatPlugin still initialized. I've tested hotswap features, it just works fine. Is this normal?

skybber commented 3 years ago

It is not normal. It looks that method org.apache.catalina.webresources.StandardRoot.getResourceInternal() did not change for a long time. HA use name references to method params (there is parameter called path), it seems that the Sb embedded Tomcat is compiled without debug information.