Project

Profile

Help

failed to create an XPathFactory in IKVM-generated .NET app

Added by Denis Sukhoroslov about 7 years ago

I'm trying to generate .NET client from my Java client "uber" jar. The jar contains Saxon HE 9.7.0-14 lib. IKVM has generated .NET dll from the jar. Now I do a simple .NET console app which initiates my XQJ driver and connects to server. The .NET app references the generated dll and IKVM.OpenJDK.Core assembly. My XQDataSource was created with no issues but then I got an exception at XQConnection initialisation phase:

..........
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:98) ~[na:OpenJDK 7u6 b24]
        at com.hazelcast.config.AbstractConfigBuilder.(AbstractConfigBuilder.java:60) ~[bagri-1.1.1-xqj.DLL:na]
        at com.hazelcast.client.config.XmlClientConfigBuilder.(XmlClientConfigBuilder.java:111) ~[bagri-1.1.1-xqj.DLL:na]
        at com.bagri.client.hazelcast.impl.ClientManagementImpl.initializeHazelcast(ClientManagementImpl.java:203) ~[bagri-1.1.1-xqj.DLL:na]
        at com.bagri.client.hazelcast.impl.ClientManagementImpl.connect(ClientManagementImpl.java:47) ~[bagri-1.1.1-xqj.DLL:na]
        at com.bagri.client.hazelcast.impl.SchemaRepositoryImpl.initializeFromProperties(SchemaRepositoryImpl.java:94) ~[bagri-1.1.1-xqj.DLL:na]
        at com.bagri.client.hazelcast.impl.SchemaRepositoryImpl.(SchemaRepositoryImpl.java:34) ~[bagri-1.1.1-xqj.DLL:na]
        ... 5 common frames omitted

Looks like it happens at the first attempt initialise XML env in order to read internal XML config. Also the .NET console output states that Exception thrown: 'java.lang.RuntimeException' in IKVM.OpenJDK.Core.dll

It is, most probably, not an issue of Saxon at all. But may be you know how it can be resoled?

Thanks, Denis.


Replies (4)

Please register to reply

RE: failed to create an XPathFactory in IKVM-generated .NET app - Added by Michael Kay about 7 years ago

As you suggest, I don't think this is a Saxon problem. There's no Saxon code on the stack trace.

Googling for the error message "No XPathFactory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom" gets a few hits, I don't know if any of them sound remotely similar to your scenario.

I'm afraid I don't know much about your application architecture. You say things like "Now I do a simple .NET console app which initiates my XQJ driver and connects to server. " But I don't know what "my XQJ driver" is, and I don't know what kind of "server" you are referring to.

RE: failed to create an XPathFactory in IKVM-generated .NET app - Added by Denis Sukhoroslov about 7 years ago

HI Michael,

You faced this issue earlier, afaik: https://saxonica.plan.io/issues/1944. My server is a XML DB written in Java: https://github.com/dsukhoroslov/bagri. It provides a standard XQJ driver (JSR-225), also implemented in Java. Now I'm trying to convert it to .net assembly.

RE: failed to create an XPathFactory in IKVM-generated .NET app - Added by Michael Kay about 7 years ago

I don't think bug #1944 is relevant. This concerned the format of the META-INF file for Saxon's implementation of XPathFactory (in particular, the fact that the format changed between JDK versions 5 and 6). But the Saxon JAR files no longer contain a META-INF file for XPathFactory, so it's not a problem any more, regardless what JVM version you are using.

It might be worth asking on the IKVM list.

What XPathFactory are you actually trying to load: is it the Saxon one?

RE: failed to create an XPathFactory in IKVM-generated .NET app - Added by Denis Sukhoroslov about 7 years ago

The standard one from Java rt.jar. I resolved the issue now adding references to IKVM.OpenJDK.XML.API and IKVM.OpenJDK.XML.XPath assemblies.

    (1-4/4)

    Please register to reply