OpenJPA
  1. OpenJPA
  2. OPENJPA-2288

MetaDataRepository should be able to filter classes from other app ClassLoaders in JEE Env

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1, 2.2.0
    • Fix Version/s: 2.1.2, 2.2.2, 2.2.1.1, 2.3.0
    • Component/s: kernel
    • Labels:
      None

      Description

      When an enhanced Class is loaded by a ClassLoader, its static initializer registers it with metadata in a map in the PCRegistry. Every MetaDataRepository that registers as a listener with the PCRegistry will receive each class, regardless of whichever ClassLoader it is associated with. In a JEE environment, this means all Classes from all Applications (including stopped Applications whose ClassLoaders have not yet been Garbage Collected) are received by each MDR instance in the MDR.processRegisteredClasses() method.

      It has been found that there is a problem in the MDR.processRegisteredClasses() method. While processing each registrant, one of the first things it attempts to do is instantiate the class to determine whether the version level of the enhancer that enhanced the class is compatible with the runtime. If the class constructor contains application logic that addresses static (session-context sensitive) data and does not gracefully capture the resulting RuntimeException, it can cause the JPA operation responsible for triggering the MDR.pRC() operation to fail.

      As a Compatibility option, I propose enabling a filter that eliminates classes that are not loadable through the envLoader (or Thread Context ClassLoader when envLoader is null). This will eliminate instantiating Classes from other applications (thus eliminating the execution of potential application custom logic embedded in the constructors) inappropriately.

        Activity

        Jody Grassel created issue -
        Jody Grassel made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Jody Grassel made changes -
        Attachment OPENJPA-2288-2.1.x.patch [ 12551215 ]
        Jody Grassel made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 2.1.2 [ 12317142 ]
        Fix Version/s 2.3.0 [ 12319463 ]
        Fix Version/s 2.2.2 [ 12323356 ]
        Fix Version/s 2.2.1.1 [ 12323484 ]
        Resolution Fixed [ 1 ]
        Jody Grassel made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Jody Grassel
            Reporter:
            Jody Grassel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development