KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using Java SE 6 on Mac OS X and Saxon-HE 9.3.0.5. The ServiceLoader is not able to find the Saxon implementation of javax.xml.xpath.XPathFactory . mac:test2 ludo$ java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode) The javadoc of the newInstance method of javax.xml.xpath.XPathFactory states in point 3 of the lookup procedure to localize an implementation that: The class loader is asked for service provider provider-configuration files matching javax.xml.xpath.XPathFactory in the resource directory META-INF/services. See the JAR File Specification for file format and parsing rules. The Service Provider section of the JAR File Specification states that: The file should contain a newline-separated list of unique concrete provider-class names. But if I extract the saxon9he.jar file and look into the META-INF directory, I see: mac:Java ludo$ mkdir test mac:Java ludo$ cd test mac:test ludo$ jar fx ../saxon9he.jar mac:test ludo$ cat META-INF/services/javax.xml.xpath.XPathFactory net.sf.saxon.xpath.XPathFactoryImpl http\://java.sun.com/jaxp/xpath/dom: net.sf.saxon.xpath.XPathFactoryImpl http\://saxon.sf.net/jaxp/xpath/om: net.sf.saxon.xpath.XPathFactoryImpl The first line is correct but I can't see why there are two extra lines and it looks like those lines are causing trouble to ServiceLoader. I saw the problem with a test example that I wrote the understand the mecanism used to find a provider. We can see that saxon9he.jar is in the CLASSPATH. mac:services ludo$ java ServicesTest CLASSPATH = ..., /Users/ludo/Libra
Tags (comma-separated)
Save Edits
Cancel