-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.IllegalAccessError: no such constructor: org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext.<init>(XSModel,Document)void/newInvokeSpecial #655
Comments
ikvmc changes the constructor to
Probably an error with the Maven type resolution, as in it doesn't find the XSModel. Source for DefaultDynamicContext: https://github.com/xercesj/xpath20/blob/master/webtools.sourceediting.xpath/bundles/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/DefaultDynamicContext.java |
Btw, adding
Fixes the startup error. |
I think the problem is a string not being interned. I'm doing a deep dive. |
So, here's what's happening as I understand it so far. The primary package: com.evolvedbinary.thirdparty.org.eclipse.wst.xml:xpath2 produces xpath2.dll. The JAR file of xpath2.jar references classes which only exist in xercesImpl.jar. However, the Maven package for the first does NOT have a reference to the second. Hence why you had to put both MavenReferences in the csproj. They didn't automatically depend on each other. Because the dependencies are missing. But just putting them both in the csproj doesn't cause the compiler to actually consider them as depending on each other. So, xpath2 is compiled without reference to xercesImpl. Viewing the logs for that we see:
So, a bunch of errors because the classes are missing, because the reference was not added at compile time. These errors are not fatal. What happens is IKVM, insert of failing, defaults to dynamic dispatch for these missing types in the xpath2 assembly. What this means is any method that would accept these classes, or any reference to these classes, are replaced by System.Object. So, the ctor that is missing is in this situation. The ctor was legit not created with the expected signature. Instead, the first argument it accepts is System.Object. When resolving the constructor, then, the dynamic lookup goes through RuntimeJavaType.GetMethodWrapper. That scans the methods for matching names and signatures. It looks like the original signature is coming through correctly. But the code isn't matching it:
That loop isn't finding it. But the values seem correct. So I think because it's doing a reference compare one side isn't interned. |
Many thanks @AliveDevil , good to know. |
That fixed it? For real? |
That at least allows me to run the code to perform the XSD 1.1 validation using XPath 2 in assertions, of course I would prefer not to have to use the explicit loading with |
Okay. I see. I was misled by the debugger. Test was working. This comes down to the code in sun.invoke.util.VerifyAccess. A method I don't quite fully understand yet. Part of which is overridden by map.xml to return null for the class loader of the second type if and only if it appears in the bootstrap class loader. I don't understand the point of this yet. |
I have contacted the guy that produces these com.evolvedbinary.thirdparty packages whether he could add the missing dependencies. But according to him
I don't have much experience with creating Maven/POM files and dependencies, I mainly consume them; @wasabii, what's your opinion on this case, can the cyclic interdependencies between xercesImpl and xpath2 be cleanly specified on Maven to cater for both Maven rules as well as to allow IKVM.Maven to find and collect and load all assemblies without having to resort to explicit |
No, Maven does not support cyclic dependencies. So the classes on one side or the other, whichever that may work out to be, end up using dynamic dispatch to the other. I do believe though that since these are generated by IKVM.Maven.Sdk, and IKVM.Maven.Sdk uses the AppDomainAssemblyClassLoader by default, you don't have to call ikvm.runtime.Startup.addBootClassPathAssembly. It should be sufficient to just load it in .NET. Assembly.Load, etc. |
I am trying to the lastet IKVM/IKVM.Maven release with .NET 8 to use the Apache Java Xerces library with XSD 1.1. support.
However, I can't use the XSD 1.1 features depending on the used XPath 2 library as under IKVM I get an error
java.lang.IllegalAccessError: no such constructor: org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext.<init>(XSModel,Document)void/newInvokeSpecial
.Complete stack is below, sample project is at https://github.com/martin-honnen/Xsd11IkvmTest1.
Any hints appreciated on how to resolve this.
The text was updated successfully, but these errors were encountered: