[ 
https://issues.apache.org/jira/browse/DELTASPIKE-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Andraschko resolved DELTASPIKE-1432.
-------------------------------------------
    Fix Version/s: 1.9.6
       Resolution: Fixed

> Proxy class definition does not work
> ------------------------------------
>
>                 Key: DELTASPIKE-1432
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1432
>             Project: DeltaSpike
>          Issue Type: Improvement
>      Security Level: public(Regular issues) 
>          Components: Proxy-Module
>    Affects Versions: 1.9.5
>            Reporter: Christian Beikov
>            Priority: Major
>             Fix For: 1.9.6
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> In 
> {{org.apache.deltaspike.proxy.impl.AsmDeltaSpikeProxyClassGenerator#loadClass}}
>  the current implementation always tries to make the 
> {{ClassLoader#defineClass}} method (of module java.base) accessible which is 
> disallowed by default since 16. To workaround this, one has to add the 
> following command line flags {{\--add-opens java.base/java.lang=ALL-UNNAMED}} 
> or {{\--add-opens java.base/java.lang=deltaspike.proxy.module.impl.asm}} if 
> running in modular mode. This can be properly implemented though by using the 
> new supported API {{java.lang.invoke.MethodHandles.Lookup#defineClass}} like 
> Weld 3.1.7 now also did. This would help usability of Deltaspike a lot.
> Here is the exception one sees without the flag:
>  
> {code}
> java.lang.reflect.InaccessibleObjectException: Unable to make protected final 
> java.lang.Class 
> java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
>  throws java.lang.ClassFormatError accessible: module java.base does not 
> "opens java.lang" to module deltaspike.proxy.module.impl.asm
>               at 
> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
>               at 
> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
>               at 
> java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
>               at 
> java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
>               at 
> [email protected]/org.apache.deltaspike.proxy.impl.AsmDeltaSpikeProxyClassGenerator.loadClass(AsmDeltaSpikeProxyClassGenerator.java:528)
>               at 
> [email protected]/org.apache.deltaspike.proxy.impl.AsmDeltaSpikeProxyClassGenerator.generateProxyClass(AsmDeltaSpikeProxyClassGenerator.java:73)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to