New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to scan my classes loaded by external tomcat servers within the premain method of a Java agent #794
Comments
This comment was marked as spam.
This comment was marked as spam.
You'll need to go through the logs in both versions and figure out which classpath elements are not found in the newer version. Then we can look into why those aren't found in the newer version. As far as why there are 50k classes are missing even in the older version, it's possible that the Catalina classpath handler is incomplete. If you can figure out by introspection or using a debugger just how those classes are found in your runtime environment, we can extend the Catalina classpath handler to find those too. |
This is the code that handles Catalina: Line 40 in 5f94ed6
|
Thank you for your suggestion. But I can not debugger in scan method,I don't know what I did wrong. |
OK, I'm traveling right now, I'll try to take a look soon. However you don't need to debug the scan. You just need to figure out which classloader in your runtime environment contains references to the missing classes, by stilopping a "hello world" program at the start of the run, and looking up the classloader(s), then looking at their fields. Then you can look at the code I linked to see why ClassGraph doesn't find those classes. |
@601724080 I got the Spring Boot app running, but I couldn't figure out how to get the external Tomcat app running. I installed Tomcat and tried installing the Tomcat tools plugin from Eclipse marketplace, but the Tomcat launch profile type did not appear. |
@lukehutch en, the new version eclispe should download something to support it,i add the operation method in my reproduction project,you can give it a try. |
Hi @601724080 , I followed your steps, but I can't get "Tomcat Server" to appear as a launch configuration type. It's not in the list. |
@lukehutch What version of Eclipse are you using? I will use the same version to take a look. |
2023-06, but I doubt the version of Eclipse matters much... Can you please try getting the verbose logs in both run types, and attach them here? Call |
the log is too long, so i commit it in my project, the branch_main.log print all my class and the branch_external-tomcat.log print nothing |
@601724080 I'm sorry it took me so long to respond! Your The main branch in particular finds In the external branch, can your code find the One other thing that is puzzling me is how the main branch is able to find the
These should show lines like Hmm.... Any more tips as to how I can get the external branch to launch? |
@601724080 ping... |
tomcat server: 8.5.93
platform: win11
project info:spring-boot 2.1.13.RELEASE
When I used version 1, I scanned more than 10000 classes, but when I upgraded to version 4.8.162, I only scanned 5000 classes。
the correct thing is to scan out over 60000 classes,Currently, only JDK, tomcat, and my Java agent's classes are scanned out。
Is it possible to scan my classes loaded by external tomcat servers within the premain method of a Java agent?
The text was updated successfully, but these errors were encountered: