I am deploying an ear with the below structure to WildFly 9.0.2.
The preferences-lib.jar contains a custom PreferencesFactory implementing java.util.prefs.PreferencesFactory. Also defined is META-INF/services/java.util.prefs.PreferencesFactory.
By default WildFly ignores META-INF folder but allows it to be imported using the jboss-deployment-structure.xml. I have tried various combinations but WildFly keeps ignoring the META-INF folder and consequently I can't use the custom preferences factory in my application.
I have also tried adding a dummy jar with just META-INF/services/java.util.prefs.PreferencesFactory as a wildfly modules. That doesn't work either.
Please help me fix this META-INF/services import issue.
(This is related to https://developer.jboss.org/thread/271689. But trying to avoid setting system wide property for java.util.prefs.PreferencesFactory.)
Turns out the problem is with the Java Preferences class which uses system class loader to load the service provider.
I fixed this by writing my own implementation of the Preferences.systemRoot() function where it first checks for a service provider without using the system class loader.
The code is available in github link mentioned above.