1

I tried running a gluon project that uses XML to initialize the project. Seeing the following error when running the application on an IOS device:

Caused by: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:76

Note: Application runs successfully on Desktop Windows/Mac and on Android platform.

Is the Xpath not supported on IOS devices with Gluon

Vaishnavi
  • 55
  • 6
  • Can you at least post the project dependencies? A short code snippet on how you call XPath will help as well. – José Pereda Oct 23 '17 at 16:43
  • Error is thrown at : private static final XPath xPath = XPathFactory.newInstance().newXPath() The following are the dependency : // Desktop SQL -> https://github.com/xerial/sqlite-jdbc desktopRuntime 'org.xerial:sqlite-jdbc:3.8.11.2' //desktopRuntime 'com.h2database:h2:1.3.148' // Embedded SQL -> https://github.com/xerial/sqlite-jdbc embeddedRuntime 'org.xerial:sqlite-jdbc:3.7.2' // Android SQL -> https://github.com/SQLDroid/SQLDroid androidRuntime 'org.sqldroid:sqldroid:1.0.3' compile fileTree(dir: 'libs', include: '*.jar') – Vaishnavi Oct 23 '17 at 17:19

1 Answers1

0

As you can read in the exception:

No XPathFactory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom at javax.xml.xpath.XPathFactory.newInstance...

So all you need to do is provide a valid implementation.

For instance, adding this to your build.gradle:

dependencies {
    compile 'com.gluonhq:charm:4.4.0'
    compile 'xalan:xalan:2.7.2'
}

Probably there are others like 'com.sun.org.apache:jaxp-ri:1.4'.

I've tried it for this code only:

public BasicView(String name) {
    super(name);

    XPath newXPath = XPathFactory.newInstance().newXPath();
}

and I don't get the exception anymore.

José Pereda
  • 44,311
  • 7
  • 104
  • 132