Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14673

ELResolvers with jdk17 can cause InaccessibleObjectException

      Environment (Required on creation):

      C7.17 and higher, any distro with jdk17.

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      We resolve expressions via reflection. Before we invoke the expression's method we check if it's accessible via reflection and call the setAccessible on the method when needed. From Java 9 this method throws two exceptions (SecurityException & InaccessibleObjectException).
      Our logic is not handling the second exception. With previous java versions it didn't cause issues but Java 17 introduced very strong internal encapsulation rules.
      So under Java 17 starting a process can fail completely due to the second InaccessibleObjectException exception.

      Steps to reproduce (Required on creation):

      Have a bpmn process with conditional expression defined, for instance: ${actionList.contains("MANUELL")}. Start the process with the variables. In the variables add the actionList list initialised by the java.util.List.of() method.

      The process would fail with InaccessibleObjectException.

      Arrays.asList() would probably trigger the same exception (and many other classes, too).

      Observed Behavior (Required on creation):

      The process fails with InaccessibleObjectException.

      Expected behavior (Required on creation):

      The process should complete successfully.

      Root Cause (Required on prioritization):

      Expressions in the process are evaluated using reflection. When we encounter a method that's not accessible by default, we try to make it accessible. The above mentioned contains method cannot be made accessible in jdk17. So our attempt fails with an InaccessibleObjectException exception which is not handled properly in the BeanELResolver.
      (org.camunda.bpm.engine.impl.javax.el.BeanELResolver@97)

      Solution Ideas (Optional):

      Hints (optional):

      We need to handle both exceptions whenever we call method.setAccessible(). However we can't use classes that are not available in Java 8 as we still build our codebase with that.

        This is the controller panel for Smart Panels app

            [CAM-14673] ELResolvers with jdk17 can cause InaccessibleObjectException

            Daniel Kelemen created issue -
            Daniel Kelemen made changes -
            Link New: This issue is related to SUPPORT-13698 [ SUPPORT-13698 ]
            Daniel Kelemen made changes -
            Summary Original: InaccessibleObjectException when using immutable list as process variable New: InaccessibleObjectException when using immutable list as process variable with jdk17
            Daniel Kelemen made changes -
            Summary Original: InaccessibleObjectException when using immutable list as process variable with jdk17 New: ELResolvers with jdk17 can cause InaccessibleObjectException
            Daniel Kelemen made changes -
            Assignee New: Thorben Lindhauer [ thorben.lindhauer ]
            Daniel Kelemen made changes -
            Description Original: h3. Environment (Required on creation):

            C7.17 and higher, any distro with jdk17.
             
                h3. Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

            The way we resolve process expressions can very easily violate the jdk internals encapsulation which was made quite strict with jdk17.
             
                h3. Steps to reproduce (Required on creation):

            Have a bpmn process with conditional expression defined, for instance: {{${actionList.contains("MANUELL")}}}. Start the process with the variables. In the variables add the {{actionList}} list initialised by the {{java.util.List.of()}} method.

            The process would fail with {{InaccessibleObjectException}}.

            {{Arrays.asList()}} would probably trigger the same exception with many other similar calls.
                
                h3. Observed Behavior (Required on creation):

            The process fails with {{InaccessibleObjectException}}.
                
                h3. Expected behavior (Required on creation):

            The process should complete successfully.
                
                h3. Root Cause (Required on prioritization):

            Expressions in the process are evaluated using reflection. When we encounter a method that's not accessible by default, we try to make it accessible. The above mentioned {{contains}} method cannot be made accessible in jdk17. So our attempt fails with an {{InaccessibleObjectException}} exception which is not handled properly in the {{BeanELResolver}}.
            ({{org.camunda.bpm.engine.impl.javax.el.BeanELResolver@97}})
                
                h3. Solution Ideas (Optional):
                
                h3. Hints (optional):

            Reflection clearly will cause us problems with other similar methods as well. The big questions is how we could refactor the resolvers so they can handle these classes.
            One solution could be to convert lists, sets, maps into classes that work with reflections, like {{ArrayList}}, {{HashMap}} and so on.
            New: h3. Environment (Required on creation):

            C7.17 and higher, any distro with jdk17.
             
                h3. Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

            The way we resolve process expressions can very easily violate the jdk internals encapsulation which was made quite strict with jdk17.
             
                h3. Steps to reproduce (Required on creation):

            Have a bpmn process with conditional expression defined, for instance: {{${actionList.contains("MANUELL")}}}. Start the process with the variables. In the variables add the {{actionList}} list initialised by the {{java.util.List.of()}} method.

            The process would fail with {{InaccessibleObjectException}}.

            {{Arrays.asList()}} would probably trigger the same exception (and many other classes, too).
                
                h3. Observed Behavior (Required on creation):

            The process fails with {{InaccessibleObjectException}}.
                
                h3. Expected behavior (Required on creation):

            The process should complete successfully.
                
                h3. Root Cause (Required on prioritization):

            Expressions in the process are evaluated using reflection. When we encounter a method that's not accessible by default, we try to make it accessible. The above mentioned {{contains}} method cannot be made accessible in jdk17. So our attempt fails with an {{InaccessibleObjectException}} exception which is not handled properly in the {{BeanELResolver}}.
            ({{org.camunda.bpm.engine.impl.javax.el.BeanELResolver@97}})
                
                h3. Solution Ideas (Optional):
                
                h3. Hints (optional):

            Reflection clearly will cause us problems with other similar methods as well. The big questions is how we could refactor the resolvers so they can handle these classes.
            One solution could be to convert lists, sets, maps into classes that work with reflections, like {{ArrayList}}, {{HashMap}} and so on.
            Tassilo Weidner made changes -
            Remote Link New: This issue links to "Page (camunda confluence)" [ 17503 ]
            Daniel Kelemen made changes -
            Assignee Original: Thorben Lindhauer [ thorben.lindhauer ] New: Daniel Kelemen [ daniel.kelemen ]
            Daniel Kelemen made changes -
            DRI New: Daniel Kelemen [ JIRAUSER20104 ]
            Daniel Kelemen made changes -
            Status Original: Open [ 1 ] New: In Progress [ 3 ]

              daniel.kelemen Daniel Kelemen
              daniel.kelemen Daniel Kelemen
              Daniel Kelemen Daniel Kelemen
              Tassilo Weidner Tassilo Weidner
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: