Skip to content
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

graviton-ready-java: NoClassDefFoundError in JarNativeInfo misses potential native methods #57

Open
aidar-stripe opened this issue May 25, 2024 · 1 comment

Comments

@aidar-stripe
Copy link

aidar-stripe commented May 25, 2024

Describe the bug

When you ask tool to verify N jars, that are dependent on each other, like:

  • jar1 -> Class1
  • jar2 -> Class2
  • jar3 -> Class3

And Class2 has a dependency on Class1 and also contains native methods, JarNativeInfo would try to load Class2, but fail will NoClassDefFound error, that would be ignored: https://github.com/aws/porting-advisor-for-graviton/blob/main/src/advisor/tools/graviton-ready-java/src/main/java/com/amazonaws/labs/GravitonReadyAssessor/JarNativeInfo.java#L185

This just results in skipping some native methods and marking libraries as "good" without them actually being "good".

Proposed fix

It would be better to not try to load class into JVM, but rather parse the bytecode using javassist. That way class could be analyzed for presence of native methods without loading all dependent classes.

@aidar-stripe aidar-stripe changed the title NoClassDefFoundError in JarNativeInfo misses potential native methods graviton-ready-java: NoClassDefFoundError in JarNativeInfo misses potential native methods May 25, 2024
@bhallasaksham
Copy link

Thank you for your reaching out @aidar-stripe. Our team will take a look at this and get back to you with any comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants