【发生条件】
使用Java 11时
使用iAP/Accel Platform/2018 Winter及之后版本
【原因】
由于有更改Attach API的设计(式样)。
【规避方法】
在JVM选项中添加 -Djdk.attach.allowAttachSelf=true
【详细信息】
计算Ehcache的内存大小将使用Sizeof Engine功能。
在Sizeof Engine的1种实现无法加载时,将输出“Failed to attach to VM and load the agent”的信息。
Sizeof Engine提供了3种实现,输出此信息时将使用其它的实现,因此对运用等没有影响。
想要在版本升级等中使用与之前版本(使用Java 8时)相同的实现时,请在Resin启动时的JVM选项中添加 -Djdk.attach.allowAttachSelf=true。
通过添加 -Djdk.attach.allowAttachSelf=true,将不输出“Failed to attach to VM and load the agent”的信息,而输出如下信息。
[INFO] n.s.e.p.s.AgentLoader - []Extracted agent jar to temporary file tmp\ehcache-sizeof-agentXXXXXXXXXXXXXXXXXXXXX.jar
[INFO] n.s.e.p.s.AgentLoader - []Trying to load agent @ tmp\ehcache-sizeof-agent.XXXXXXXXXXXXXXXXXXXXXjar
-- 适用对象 ----------------------------------------------------------------
iAP/Accel Platform/2018 Winter及之后版本
--------------------------------------------------------------------------------
FAQID:1000
显示登录页面时,日志中将输出Failed to attach to VM and load the agent: class java.lang.reflect.InvocationTargetException: null的信息。