You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "David Griffon (Jira)" <ji...@apache.org> on 2023/03/30 15:37:00 UTC

[jira] [Created] (UNOMI-760) Class loading issue with groovy script

David Griffon created UNOMI-760:
-----------------------------------

             Summary: Class loading issue with groovy script
                 Key: UNOMI-760
                 URL: https://issues.apache.org/jira/browse/UNOMI-760
             Project: Apache Unomi
          Issue Type: Bug
            Reporter: David Griffon


As groovy use intensively reflection in its execution, it happens that the following error happen while using JDK11:

{code}
023-03-28T09:33:57,288 | ERROR | qtp403863476-98  | GroovyActionDispatcher           | 219 - org.apache.unomi.groovy-actions-services - 1.8.0 |  Error executing Groovy action with key=updateContactDetailsAction 
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: jdk/internal/reflect/ConstructorAccessorImpl
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:113) ~[?:?]
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) ~[?:?]
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1262) ~[?:?]
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1029) ~[?:?]
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:809) ~[?:?]
	at groovy.lang.GroovyObject.invokeMethod(GroovyObject.java:39) ~[?:?]
....
Caused by: java.lang.ClassNotFoundException: Unable to load class 'jdk.internal.reflect.ConstructorAccessorImpl'
	at org.apache.felix.framework.BundleWiringImpl$1.loadClass(BundleWiringImpl.java:92) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1583) ~[?:?]
	at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
	at org.codehaus.groovy.runtime.callsite.CallSiteClassLoader.loadClass(CallSiteClassLoader.java:54) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
{code}

The issue may happen since JDK9 on which some internal package used for reflexion are not exposed to the OSGi runtime
see https://www.oracle.com/java/technologies/javase/9-relnotes.html (look for internal) 

A way of fixing it is to add the class to the boot delegation of the framework.

Note that the issue has been reported on felix issues:
https://issues.apache.org/jira/browse/FELIX-6184




--
This message was sent by Atlassian Jira
(v8.20.10#820010)