How can I tell my application that it shouldn't use an external Service Provider from a jar?

1.1k views Asked by At

For some reason we need the xdb.jar from the Oracle XDK. This jar depends on the xmlparserv2.jar. The actual problem is that the xmlparserv2.jar comes with some provider-configuration files (META-INF/services). The jar has Services Providers for javax.xml.transform.TransformerFactory, javax.xml.parsers.SAXParserFactory and javax.xml.parsers.DocumentBuilderFactory. The implementations (from oracle.*) don't work together with some other parts of our software (they need the standard factories).

4

There are 4 answers

0
alexvetter On BEST ANSWER

I solved the problem by removing the services (META-INF/services). We ran our unit tests and everything worked. Even the parts of our software which are depending on xmlparserv2.jar/xdb.jar.

1
Fortega On

You could just remove these classes from the xmlparserv2.jar

3
Bozho On

See here - "JNLP classpath precedence 1.5 vs 1.6"

0
M Platvoet On

You could use separate classloaders to isolate the jars from the rest of the application. This question about covers it.