1 year ago
#388760
user3111249
ServiceLoader is returning empty list for services on Wildfly-17.0.1
ServiceLoader<ConnectionLoader> serviceLoader = ServiceLoader.load(ConnectionLoader.class);
My web application has 3 implementations of the ConnectionLoader
service and the above API works perfectly fine on almost all the web application servers except Wildfly-17.0.1.
Wildfly-17.0.1 deployment is failing with the above API returning an empty list. And i am not able to understand why this is happening.
My system configuration is:
- Operating System : RHEL7.6
- MSSQL Server 2019 - 192.168.25.105
- JDK - Oracle JDK 11
Also, I have verified that -
- Service entries are present and correct inside the META-INF/services
- I can load the class/implementation service using reflection. So it does not seems to be a ClassLoader issue.
- But when I call the
ServiceLoader.load(ConnectionLoader.class,ConnectionLoader.class.getClassLoader())
it works perfectly fine. Even though this works I cannot change the implementation for around 100s of services. And leave the 3rd party dependencies or code blocks in third-party jars. - This same combination used to work last year (with JDK 1.8) and we have no idea about what's changed and why this issue is specific to this combination.
java
wildfly
serviceloader
wildfly-17
0 Answers
Your Answer