Getting below error
Caused by: java.lang.IllegalStateException: No generator was provided and there is no default generator registered
When I dig deep into the issue on debug mode, I realized that actual error is below one.
Getting org.glassfish.hk2.extension.ServiceLocatorGenerator: Provider org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl not a subtype
It was failing when invoking providers.next() in hk2-api lib
final ClassLoader classLoader = ServiceLocatorFactoryImpl.class.getClassLoader();
Iterator<ServiceLocatorGenerator> providers = java.util.ServiceLoader.load(ServiceLocatorGenerator.class,
classLoader).iterator();
while (providers.hasNext()) {
try {
return providers.next();
} catch (ServiceConfigurationError sce) {
// This can happen. See the exception javadoc for more details.
Logger.getLogger().debug("ServiceLocatorFactoryImpl", "getGenerator", sce);
// We will try the next one
}
}
- There is a interface ServiceLocatorGenerator present in kh2-api lib (org.glassfish.hk2:hk2-api:2.6.1). Error says that implementation ServiceLocatorGeneratorImpl present in hk2-locater lib (org.glassfish.hk2:hk2-locator:2.6.1) is not subtype even though it is a subtype.
- Understood that an implementation class (concrete class) cannot be a subtype of interface if they are not loader by same class loader. Assuming this was the one causing the issue.
Can someone help how to fix this issue in gralde? My env is not OSGi based.