Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5031

OGNL: An illegal reflective access operation has occurred

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.20
    • Fix Version/s: 2.5.22, 2.6
    • Component/s: Core
    • Labels:
      None
    • Environment:

      Java 11 / Linux / test environment on eclipse / Tomcat 8.5

      Description

      Running Struts on Java 11 gives a new warning about illegal reflection, not present on Java 8:

      WARNING: An illegal reflective access operation has occurred
      WARNING: Illegal reflective access by ognl.OgnlRuntime (file:/.../workspace/.../.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/.../WEB-INF/lib/ognl-3.1.21.jar) to method java.util.HashMap$Node.getKey()
      WARNING: Please consider reporting this to the maintainers of ognl.OgnlRuntime
      WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
      WARNING: All illegal access operations will be denied in a future release

      The warning appears after using the following tag in a JSP (name of properties changed):

      <s:select name="item" key="item.key" list="items" />

      The corresponding Action contains:

      private Map<Long, String> items = new LinkedHashMap<>();

       

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              flyingfischer Markus Fischer
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: