-
-
Notifications
You must be signed in to change notification settings - Fork 704
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
After migrating to 0.9.12, Getting exception : org.reflections.RflectionException: Scanner SubTypeScanner was not configured , even after configuring the scanner. #273
Comments
Having an |
Same problem for me. Not sure if it's a regression of if I should adapt some code |
Think removing |
Same issue for Or Reflections reflections = new Reflections(new ResourcesScanner());
var resources = reflections.getResources(Pattern.compile(".*pom\\.xml"));
Does not happen with 0.9.11. |
+1 public Reflections(final Configuration configuration) {
this.configuration = configuration;
store = new Store(configuration);
if (configuration.getScanners() != null && !configuration.getScanners().isEmpty()) {
//inject to scanners
for (Scanner scanner : configuration.getScanners()) {
scanner.setConfiguration(configuration);
scanner.setStore(store.getOrCreate(scanner.getClass().getSimpleName())); // this line
}
scan();
if (configuration.shouldExpandSuperTypes()) {
expandSuperTypes();
}
}
} In 0.9.11, the constructor adds collection of all configured scanners to Store before does scan classes. By contrast, 0.9.12 create collection of all configured scanners only if it does scan something successfully. Personally, the error "was not configured" happening in 0.9.12 is a litter weird since the scanner is indeed "configured". Could we keep the behavior of 0.9.11 (pre-create collection for all configured scanners) to fix this issue ? |
Same issue here with ResourcesScanner. Works fine when resource are found but crashing when there is nothing matching the configuration. |
…8289) This commit works around a bug in version v0.9.12 of the upstream `reflections` library by catching and handling the exception thrown. The reflections issue is tracked by: ronmamo/reflections#273 New unit tests were introduced to test the behavior. * KAFKA-9712: Catch and handle exception thrown by reflections scanner * Update connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java Co-Authored-By: Konstantine Karantasis <konstantine@confluent.io> * Move result initialization back to right before it is used * Use `java.io.File` in tests * Fix checkstyle Co-authored-by: Konstantine Karantasis <konstantine@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
…8289) This commit works around a bug in version v0.9.12 of the upstream `reflections` library by catching and handling the exception thrown. The reflections issue is tracked by: ronmamo/reflections#273 New unit tests were introduced to test the behavior. * KAFKA-9712: Catch and handle exception thrown by reflections scanner * Update connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java Co-Authored-By: Konstantine Karantasis <konstantine@confluent.io> * Move result initialization back to right before it is used * Use `java.io.File` in tests * Fix checkstyle Co-authored-by: Konstantine Karantasis <konstantine@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
I also have this problem.I wan to change another lib. |
We just switched to https://github.com/aschoerk/reflections8 (version 0.11.7). Even so it says that it is obsolete after reflections 0.9.12 release, they don't have this bug. |
What's the status here? This is a breaking issue that's been open for 5-6 months now, and the pr to fix it got closed without an update? |
Any updates? It is really strange that PR with fix of a problem was closed even without a comment. |
I've faced with the same bug. Migrated to reflections8 |
I upgraded 2 days ago from 0.9.11 to 0.9.12 and I am still seeing this issue |
Just to clarify my previous comment - you'd have to be using 0.9.13-SNAPSHOT to have the commit I think may have fixed it. |
How can I get 0.9.13-SNAPSHOT? |
@AntonOyung I think you'll have to build it from source yourself. It doesn't look like SNAPSHOT builds get pushed to a maven repository. |
I ran into the same issue when migrating from JDK8 to JDK11. //-------------------------------------------
// Old instantiation that throws an error with
// reflections 0.9.12 and JDK 11 or higher
// Reflections reflections = new Reflections(new ConfigurationBuilder()
// //.filterInputsBy(new FilterBuilder().exclude(FilterBuilder.prefix("com.xresch.cfw.")))
// .filterInputsBy(new FilterBuilder().exclude(FilterBuilder.prefix("java.")))
// .setUrls(ClasspathHelper.forClassLoader())
// //.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner())
// );
//-------------------------------------------
// New instantiation that works with
// Reflections 0.9.12 and JDK8 or higher
// scans all classes
Reflections reflections = new Reflections("");
//-------------------------------------------
// No changes here
Set<Class<?>> types = reflections.getTypesAnnotatedWith(CFWExtensionApplication.class);
for(Class<?> clazz : types) {
if(CFWAppInterface.class.isAssignableFrom(clazz)) {
new CFWLog(logger).method("loadExtentionApplication").info("Load CFW Extension Application:"+clazz.getName());
try {
CFWAppInterface instance = (CFWAppInterface)clazz.newInstance();
return instance;
} catch (InstantiationException | IllegalAccessException e) {
new CFWLog(logger).method("loadExtentionApplication").severe("Error loading CFW Extension Application:"+clazz.getName(), e);
}
}
} |
Apparently I'm able to invoke our codepropertygraph's console via a path that triggers ronmamo/reflections#273. This is very unfortunate and due to the way the artifact is being publishes I'm unable to downgrade directly in the project I use. The fix is in 0.9.13-SNAPSHOT (not yet released) so suggestig to downgrade until it is officially out.
…pache#8289) This commit works around a bug in version v0.9.12 of the upstream `reflections` library by catching and handling the exception thrown. The reflections issue is tracked by: ronmamo/reflections#273 New unit tests were introduced to test the behavior. * KAFKA-9712: Catch and handle exception thrown by reflections scanner * Update connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java Co-Authored-By: Konstantine Karantasis <konstantine@confluent.io> * Move result initialization back to right before it is used * Use `java.io.File` in tests * Fix checkstyle Co-authored-by: Konstantine Karantasis <konstantine@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
apologize for this inconvenience ! scanner was not configured exception - this is a known issue in 0.9.12, a simple workaround is to check if the |
fixed on 0.10 |
Increment reflections version, as DomainToStringTest was affected by this bug: ronmamo/reflections#273
Increment reflections version, as DomainToStringTest was affected by this bug: ronmamo/reflections#273
Increment reflections version, as DomainToStringTest was affected by this bug: ronmamo/reflections#273
While also: 1. Upgrade reflection library due to ronmamo/reflections#273 2. Memoized list of classloaders as it's getting called on each processed file. 3. Added tests for SimpleCache 4. Added tests CodeGenerator fix 5. Minor adjustments
Resolves bug described at ronmamo/reflections#273
Addresses bug described in reflections 0.9.12 ronmamo/reflections#273
Addresses bug described in reflections 0.9.12 ronmamo/reflections#273
I was using 0.9.11 and with scanners it was working fine. but by just changing the version to 0.9.12 , stared getting the exception for "org.reflections.RflectionException: Scanner SubTypeScanner was not configured".
I noticed that, when I add a class which extend some class to the package, this error goes.
Same with FieldAnnotationScanner , or any other scanner.
To try , please provide an invalid package for reflection creation, you will see all these errors coming even after configuring all scanners with reflection
The text was updated successfully, but these errors were encountered: