You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My environement is a tomcat running a book shop. This shop has a class "Database" inter alia containing 2 static methods. Method 1: "getBook" calls another static method "getConnection", that returns a database connection. After instrumenting getBook via AIM, a runtime exception is thrown on the next call to getBook when the trace should also be instrumented. That says, that the class "Database" cannot be found.
Why this happens?
When AIM instruments the method "getBook", the "Database" class is loaded by the class loader of Tomcat. After instrumenting "getBook", AIM wants to instrument the trace, the methods called from "getBook". Here is the exception thrown because, the trace instrumentation wants to load the class from the boot class loader of Tomcat, but the "Database" class isn't there anymore.
Hotfix?
We found out that we can hotfix this problem. We need to say, that the javassist.runtime.Desc class should load the class not by default from the boot class loader but from the context class loader, that is in this case the WebappClassLoader of Tomcat.
This line of code directs the class loader to load the classes from the thread and not from the boot class loader.
Future work:
We think, that it would be useful to do this by default in the use cases of AIM.
So this setting should done eventually on initializing the Mainagent instead of every time the trace gots instrumented.
The text was updated successfully, but these errors were encountered:
My environement is a tomcat running a book shop. This shop has a class "Database" inter alia containing 2 static methods. Method 1: "getBook" calls another static method "getConnection", that returns a database connection. After instrumenting getBook via AIM, a runtime exception is thrown on the next call to getBook when the trace should also be instrumented. That says, that the class "Database" cannot be found.
Why this happens?
When AIM instruments the method "getBook", the "Database" class is loaded by the class loader of Tomcat. After instrumenting "getBook", AIM wants to instrument the trace, the methods called from "getBook". Here is the exception thrown because, the trace instrumentation wants to load the class from the boot class loader of Tomcat, but the "Database" class isn't there anymore.
Hotfix?
We found out that we can hotfix this problem. We need to say, that the javassist.runtime.Desc class should load the class not by default from the boot class loader but from the context class loader, that is in this case the WebappClassLoader of Tomcat.
As hotfix we insert some code here:
This line of code directs the class loader to load the classes from the thread and not from the boot class loader.
Future work:
We think, that it would be useful to do this by default in the use cases of AIM.
So this setting should done eventually on initializing the Mainagent instead of every time the trace gots instrumented.
The text was updated successfully, but these errors were encountered: