Caused by: java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class.
Exception Details:
Location: org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.setupJmxPort(Lorg/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean;Ljava/lang/Integer;)V @1: invokespecial
Reason:
Error exists in the bytecode
Bytecode:
…………
…………
…………
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489)
... 22 common frames omitted
java -jar -javaagent:demo.jar
今天我java -jar -javaagent执行一个jar包的时候出现如题报错,具体如上报错代码。网上查了半天,换了jdk版本,换了maven依赖库,各种方式尝试之后都没法解决,后来启动命令加了-noverify之后即可运行起来,即:
java -jar -noverify -javaagent:demo.jar
在此记录一下,至于为何报错还没能找到真正原因,有知道的伙伴也可以留言告知一下,谢谢!