lemminx icon indicating copy to clipboard operation
lemminx copied to clipboard

SecurityException during native image compilation

Open BoykoAlex opened this issue 2 years ago • 1 comments

I'm trying to native compile a language server app (Boot LS) that depends on lemminx jar. The error is below:

Caused by: java.lang.SecurityException: class "com.thaiopensource.relaxng.pattern.MySchemaPatternBuilder"'s signer information does not match signer information of other classes in the same package
	at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1158)
	at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:902)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVM.resolveTypeInPool(Native Method)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(HotSpotConstantPool.java:773)
	at java.base/jdk.internal.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.loadReferencedType(WrappedConstantPool.java:152)

The issue is that com.thaiopensource.relaxng.pattern package is contained in 2 different JARs: lemminx and jing (dependency)

I noticed that there is a native-image folder contained the project which means this project likely was attempted to be compiled into a native image. Wonder if this compilation has succeeded and if yes how did you get around the error above? Has there been a way to suppress the SecurityException in the analysis stage?

If this was an issue previously as well wonder how hard it would be renaming com.thaiopensource.relaxng.pattern package in lemminx code base?

BoykoAlex avatar Oct 13 '23 20:10 BoykoAlex

If this was an issue previously as well wonder how hard it would be renaming com.thaiopensource.relaxng.pattern package in lemminx code base?

It is a problem with jing, See https://github.com/relaxng/jing-trang/issues/271

angelozerr avatar Oct 13 '23 20:10 angelozerr