如何告诉我的应用程序它不应该使用jar中的外部服务提供程序? [英] How can I tell my application that it shouldn't use an external Service Provider from a jar?
问题描述
出于某种原因,我们需要来自Oracle XDK的xdb.jar。这个jar依赖于xmlparserv2.jar。实际问题是xmlparserv2.jar附带了一些提供程序配置文件(META-INF / services)。该jar具有 javax.xml.transform.TransformerFactory , javax.xml.parsers.SAXParserFactory 和 javax.xml.parsers.DocumentBuilderFactory 的服务提供者。实现(来自oracle。*)不能与我们软件的其他部分一起使用(它们需要标准工厂)。
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).
推荐答案
我通过删除服务(META-INF / services)解决了这个问题。我们进行了单元测试,一切正常。甚至我们软件的部分依赖于xmlparserv2.jar / xdb.jar。
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.
这篇关于如何告诉我的应用程序它不应该使用jar中的外部服务提供程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!