Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4877

ZKBind still use illegal reflective access which is not allowed anymore with JDK 16

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 9.6.0
    • 9.5.1.2
    • Databind 2
    • Security Level: Jimmy
    • OpenJDK 16
      Spring Boot 2.4.5
      zkspringboot 2.3.0

    • None

      Steps to Reproduce

      Example with a simple form

       

      <div form="@id('c') @load(courseVm.course) @save(courseVm.course, before='createCourse')">
          <textbox hflex="1" value="@bind(c.title)"/>
          <button label="Create" onClick="@command('createCourse')"/>
      </div>
      

       

      Current Result

      On form load, the exception

      java.lang.reflect.InaccessibleObjectException

      is raised.

      Expected Result

      The form loads without any error.

      Debug Information

      https://github.com/jboss-javassist/javassist/issues/194

      Stack trace :

      2021-04-23 12:56:47.457 ERROR 20421 --- [  XNIO-1 task-5] org.zkoss.zk.ui.impl.UiEngineImpl        :
      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 unnamed module @5ecddf8f
      at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) ~[na:na]
      at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
      at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[na:na]
      at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) ~[na:na]
      at javassist.util.proxy.SecurityActions.setAccessible(SecurityActions.java:103) ~[javassist-3.18.2-GA.jar!/:na]
      at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181) ~[javassist-3.18.2-GA.jar!/:na]
      at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:164) ~[javassist-3.18.2-GA.jar!/:na]
      at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:507) ~[javassist-3.18.2-GA.jar!/:na]
      at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:492) ~[javassist-3.18.2-GA.jar!/:na]
      at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:428) ~[javassist-3.18.2-GA.jar!/:na]
      at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:400) ~[javassist-3.18.2-GA.jar!/:na]
      at org.zkoss.bind.proxy.ProxyHelper.createFormProxy(ProxyHelper.java:278) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.FormBindingImpl.initFormBean(FormBindingImpl.java:81) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.SaveFormBindingImpl.getFormBean(SaveFormBindingImpl.java:117) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.SaveFormBindingImpl.<init>(SaveFormBindingImpl.java:70) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.BinderImpl.newSaveFormBinding(BinderImpl.java:1168) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.BinderImpl.addFormSaveBindings0(BinderImpl.java:875) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.BinderImpl.addFormSaveBindings(BinderImpl.java:807) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.AnnotateBinderHelper.processFormSaveBindings(AnnotateBinderHelper.java:648) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.AnnotateBinderHelper.processFormBindings(AnnotateBinderHelper.java:553) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.AnnotateBinderHelper.processComponentBindings0(AnnotateBinderHelper.java:125) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.AnnotateBinderHelper.processAllComponentsBindings(AnnotateBinderHelper.java:90) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.impl.AnnotateBinderHelper.initComponentBindings(AnnotateBinderHelper.java:76) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.tracker.impl.BindUiLifeCycle.reInitBinder0(BindUiLifeCycle.java:163) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.tracker.impl.BindUiLifeCycle.reInitBinder(BindUiLifeCycle.java:110) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.tracker.impl.BindUiLifeCycle.access$100(BindUiLifeCycle.java:56) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.bind.tracker.impl.BindUiLifeCycle$2.onEvent(BindUiLifeCycle.java:101) ~[zkbind-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:3185) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3133) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3097) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1884) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1656) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1323) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:571) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:451) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:459) ~[zk-9.5.1.2.jar!/:9.5.1.2]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:517) ~[jakarta.servlet-api-4.0.4.jar!/:4.0.4]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:584) ~[jakarta.servlet-api-4.0.4.jar!/:4.0.4]
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.6.jar!/:5.3.6]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar!/:5.3.6]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.6.jar!/:5.3.6]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar!/:5.3.6]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.6.jar!/:5.3.6]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar!/:5.3.6]
      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99) ~[undertow-servlet-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:841) ~[undertow-core-2.2.7.Final.jar!/:2.2.7.Final]
      at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) ~[jboss-threads-3.1.0.Final.jar!/:3.1.0.Final]
      at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019) ~[jboss-threads-3.1.0.Final.jar!/:3.1.0.Final]
      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558) ~[jboss-threads-3.1.0.Final.jar!/:3.1.0.Final]
      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449) ~[jboss-threads-3.1.0.Final.jar!/:3.1.0.Final]
      at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]
      

      Workaround

      Execute JAR file with option :

      --illegal-access=permit

            rudyhuang rudyhuang
            YannUnil YannUnil
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 2 hours Remaining Estimate - 6 hours
                6h
                Logged:
                Time Spent - 2 hours Remaining Estimate - 6 hours
                2h