OpenEJB
  1. OpenEJB
  2. OPENEJB-1121

Classloader issue when using OpenEJB for Junit testing with Maven2 and Cobertura

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.2
    • Fix Version/s: None
    • Component/s: container system
    • Labels:
      None

      Description

      Using Maven2 (Surefire), OpenEJB and Cobertura in Junit tests.

      If multiple instances of OpenEJB are created during a testrun ( closing OpenEJB with context.close() ), multiple shutdown hooks are registered by Cobertura. When the jvm exits all the shutdown hooks are executed and there is congestion on the report file (cobertura.ser) often resulting in incomplete coverage reports.
      The OpenEJB TempClassLoader should not load Cobertura classes, but should delegate to the parent classloader.

        Activity

        Hide
        Pär Wenåker added a comment -

        Patch that solves the problem

        Show
        Pär Wenåker added a comment - Patch that solves the problem
        Hide
        Aldrin Leal added a comment -

        Actually, the same happens when you declare static loggers with slf4j.

        Should we consider turning this validator/tempclassloader a property/feature of OpenEJB?

        Show
        Aldrin Leal added a comment - Actually, the same happens when you declare static loggers with slf4j. Should we consider turning this validator/tempclassloader a property/feature of OpenEJB?
        Hide
        David Blevins added a comment -

        Good suggestion Aldrin. We could definitely have a property of packages to skip. There's some convenient 'filter' logic in xbean-finder we could use if we upgrade to xbean-finder-3.8-SNAPSHOT that would make implementing this pretty easy. Specifically the 'packages' method of this class:

        http://svn.apache.org/repos/asf/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/filter/Filters.java

        Not fancy, but we use xbean-finder anyway and could save some time.

        I'll commit this patch and if someone has time to work in a property and supply a new patch, that would be excellent!

        Show
        David Blevins added a comment - Good suggestion Aldrin. We could definitely have a property of packages to skip. There's some convenient 'filter' logic in xbean-finder we could use if we upgrade to xbean-finder-3.8-SNAPSHOT that would make implementing this pretty easy. Specifically the 'packages' method of this class: http://svn.apache.org/repos/asf/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/filter/Filters.java Not fancy, but we use xbean-finder anyway and could save some time. I'll commit this patch and if someone has time to work in a property and supply a new patch, that would be excellent!

          People

          • Assignee:
            Unassigned
            Reporter:
            Pär Wenåker
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development