FHIR build fails with NoSuchMethodError: net.sf.sa

2019-07-15 08:09发布

问题:

Following instructions at http://wiki.hl7.org/index.php?title=FHIR_Build_Process my FHIR build is failing. I modified the publish.bat to ensure it uses the correct JDK. Running it on Windows 7 64-bit machine with JDK 1.6 (also tried JDK 1.7) and both failing with same error.

Looks like some Saxon JAR hell somewhere. Any ideas?

 ...validate v2-tables                                                     441sec  755MB
 ...validate v3-codesystems                                                443sec  889MB
Reference Platform Validation.                                             447sec 1067MB
 ...test adversereaction-example                                           447sec 1067MB
Exception in thread "main" java.lang.NoSuchMethodError: net.sf.saxon.Configuration.newConfiguration()Lnet/sf/saxon/Configuration
;
        at net.sf.saxon.xpath.XPathFactoryImpl.<init>(XPathFactoryImpl.java:33)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at javax.xml.xpath.XPathFactoryFinder.loadFromService(XPathFactoryFinder.java:401)
        at javax.xml.xpath.XPathFactoryFinder._newFactory(XPathFactoryFinder.java:222)
        at javax.xml.xpath.XPathFactoryFinder.newFactory(XPathFactoryFinder.java:143)
        at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:185)
        at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:99)
        at org.hl7.fhir.tools.publisher.Publisher.testSearchParameters(Publisher.java:2796)
        at org.hl7.fhir.tools.publisher.Publisher.testSearchParameters(Publisher.java:2785)
        at org.hl7.fhir.tools.publisher.Publisher.validateRoundTrip(Publisher.java:2759)
        at org.hl7.fhir.tools.publisher.Publisher.validateXml(Publisher.java:2656)
        at org.hl7.fhir.tools.publisher.Publisher.execute(Publisher.java:378)
        at org.hl7.fhir.tools.publisher.Publisher.main(Publisher.java:281)

回答1:

A workaround... do a fresh build of the publisher tool jar from source.

Following instructions in the build/buildhowto.txt I was able to build the tool jar inside Eclipse, run the Publisher successfully from inside Eclipse and then export it as a fresh tool jar overwriting the one I pulled from SVN. The freshly build one then ran to completion from the command line.

Could be there's just a problem with the version of tools jar out there in SVN at the moment.

For the record I am working with Version 0.12-1953.



回答2:

You have two classes net.sf.saxon.Configuration in your classpath. One containing the method newConfiguration() and one not.

The method is probably called from Saxon-HE 9.x, and the class net.sf.saxon.Configuration is found in saxon 8.x, while the class should have been found inside Saxon-HE 9.x, where it also is, and does have this method.

So, check your dependencies to see if saxon 8.x is called, and try replacing that with Saxon-HE 9.x, then your problem is solved



标签: hl7-fhir