OpenJPA
  1. OpenJPA
  2. OPENJPA-1454

InstrumentationFactory crashes the tomcat WebappClassLoader by injecting org.apache.openjpa classes into the SystemClassLoader

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M3
    • Fix Version/s: 2.1.0
    • Component/s: UnenhancedClasses
    • Labels:
      None

      Description

      The InstrumentationFactory tries to find the jar containing the manifest with the pre-main and attaches this jar to the VM.

      This has the side effect that all classes which get loaded via the Instrumentation are added to the 'classes' Vector of the SystemClassLoader. And this causes a problem when running OpenJPA in a WebApplication - because the SystemClassLoader only contains a few of those class definitions, and e.g. executing

      public void setBrokerFactory(BrokerFactory factory)

      { _factory = new DelegatingBrokerFactory(factory, PersistenceExceptions.TRANSLATOR); }

      crashes the WebApp because org.apache.openjpa.util.Exceptions is available in the SystemClassLoader but the dependent J2DoPrivHelper is not.

      This is even more problematic when using openjpa-lib, openjpa-kernel, etc as single jars (instead of openjpa-all), because in this case only openjpa-kernel gets injected into the VMs system classpath - causing the agent to subsequently crash because all the classes from openjpa-lib obviously cannot be found.

      This might also be an explanation to a few other open JIRAs I've read through the last few days.

        Activity

        Donald Woods made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Donald Woods made changes -
        Fix Version/s 2.1.0 [ 12314542 ]
        Fix Version/s 2.0.0 [ 12314019 ]
        Donald Woods made changes -
        Assignee Donald Woods [ drwoods ]
        Donald Woods made changes -
        Field Original Value New Value
        Fix Version/s 2.0.0 [ 12314019 ]
        Mark Struberg created issue -

          People

          • Assignee:
            Donald Woods
            Reporter:
            Mark Struberg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development