Skip to content
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

DL-Learner fails to init() with latest JDK >16 #104

Open
posixcompliance opened this issue Apr 22, 2022 · 1 comment
Open

DL-Learner fails to init() with latest JDK >16 #104

posixcompliance opened this issue Apr 22, 2022 · 1 comment

Comments

@posixcompliance
Copy link

Hello,

I wanted to bring to light an error I am receiving when running components-core FatherExample unit test with my current JDK 17. This error occurs despite setting the target language to 8.

Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.apache.jena.rdf.model.impl.ResourceImpl.fresh(ResourceImpl.java:141)
	at org.apache.jena.rdf.model.impl.ResourceImpl.<init>(ResourceImpl.java:87)
	at org.apache.jena.rdf.model.ResourceFactory$Impl.createResource(ResourceFactory.java:313)
	at org.apache.jena.rdf.model.ResourceFactory.createResource(ResourceFactory.java:92)
	at org.apache.jena.vocabulary.XSD.<clinit>(XSD.java:183)
	at Test.main(Test.java:40)
Caused by: java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make java.lang.invoke.MethodHandles$Lookup(java.lang.Class) accessible: module java.base does not "opens java.lang.invoke" to unnamed module @34123d65
	at org.aksw.jena_sparql_api.mapper.proxy.MapperProxyUtils.createProxyFactory(MapperProxyUtils.java:1327)
	at org.aksw.jena_sparql_api.mapper.proxy.JenaPluginUtils.createImplementation(JenaPluginUtils.java:194)
	at org.aksw.jena_sparql_api.mapper.proxy.JenaPluginUtils.registerResourceClass(JenaPluginUtils.java:228)
	at org.aksw.jena_sparql_api.mapper.proxy.JenaPluginUtils.registerResourceClasses(JenaPluginUtils.java:169)
	at org.aksw.jena_sparql_api.mapper.proxy.JenaPluginUtils.registerResourceClasses(JenaPluginUtils.java:164)
	at org.aksw.jena_sparql_api.core.plugin.JenaPluginJsaCore.init(JenaPluginJsaCore.java:21)
	at org.aksw.jena_sparql_api.core.plugin.JenaPluginJsaCore.start(JenaPluginJsaCore.java:13)
	at org.apache.jena.sys.JenaSystem.lambda$init$2(JenaSystem.java:117)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.apache.jena.sys.JenaSystem.forEach(JenaSystem.java:192)
	at org.apache.jena.sys.JenaSystem.forEach(JenaSystem.java:169)
	at org.apache.jena.sys.JenaSystem.init(JenaSystem.java:115)
	at org.apache.jena.graph.NodeFactory.<clinit>(NodeFactory.java:32)
	... 6 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make java.lang.invoke.MethodHandles$Lookup(java.lang.Class) accessible: module java.base does not "opens java.lang.invoke" to unnamed module @34123d65
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188)
	at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181)
	at org.aksw.jena_sparql_api.mapper.proxy.MapperProxyUtils.proxyDefaultMethod(MapperProxyUtils.java:1972)
	at org.aksw.jena_sparql_api.mapper.proxy.MapperProxyUtils.createProxyFactory(MapperProxyUtils.java:1325)
	... 18 more

Process finished with exit code 1

I did manage to find a simple workaround by modifying any calls to org.apache.jena.vocabulary.XSD.getURI() in the DL-Learner source code with the intended String literal value of "http://www.w3.org/2001/XMLSchema#".

I am unsure of whether this is an issue with the included Jena dependencies or if this indicative of a fundamental change in the way reflection can be used to access library functions outside of the scope of the main module being run in the latest JDK versions.

@posixcompliance posixcompliance changed the title FatherExample.java unit fails in components-core FatherExample.java unit test fails in components-core Apr 22, 2022
@posixcompliance posixcompliance changed the title FatherExample.java unit test fails in components-core DL-Learner init() fails in components-core Apr 22, 2022
@krypt-n
Copy link

krypt-n commented Apr 25, 2022

I believe I encountered the same problem and added --add-opens java.base/java.lang=ALL-UNNAMED to the jvm options as a workaround

@posixcompliance posixcompliance changed the title DL-Learner init() fails in components-core DL-Learner fails to init() with latest JDK >16 May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants