I am new to AWS Lambda and what I’m trying to do is that given some custom java annotations using reflexion i want to execute the tagged methods. I am able to achieve the scanning of a particular package and extract the classes with the tagged methods doing the following:
public Set<Class<?>> getClassesInPackageAndNestedPackages(String packageName) {
Set<Class<?>> classes = new HashSet<>();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String path = packageName.replace('.', '/');
try {
Enumeration<URL> resources = classLoader.getResources(path);
while (resources.hasMoreElements()) {
URL resource = resources.nextElement();
scanDirectory(resource.getFile(), packageName, classes, classLoader);
}
} catch (IOException e) {
e.printStackTrace();
}
return classes;
}
But when I execute this code in my aws lambda it’s not finding any class with the annotation but on my local is working fine. I’m not able to understand why it’s not working on the aws lambda.