Closed LiuxuyangK closed 6 days ago
LocalDateTime
is on the boot loader, the class loader that is the parent of all class loaders. Your agent is however loaded on the system loader. As a result, ContextThreadLocalUtil
is not visible to LocalDateTime
, yielding the error you see.
Either, you need to inject the util class(es) into the boot loader (Instrumentation
allows you to append to that loader) and then you need to change the module import (also via Instrumentation
), or, easier, you include all your code in the advice class. The code in the advice is copied into the target method such that no visibility restrictions apply.
Thank you very much for your reply. The current solution is to enhance all calls to LocalDateTime. now() in the project, which is a rather clumsy approach. However, we would like to explore the two methods you introduced in the future.
Thank you again! We are about to celebrate the Chinese New Year, which is a joyful holiday. Wishing you a happy Spring Festival!
Glad I could help!
您好,我是旭阳。我已经收到了您的邮件。祝您身体健康,万事如意。
help! Looking forward to your reply! i want to advice java.time.LocalDateTime,and i use this code:
in the LocalDateTimeInterceptor ,the code is:
ContextThreadLocalUtil is a class that i write
and when i invoke LocalDateTime.now(), exception occurs: