Petals ESB Container

Impossible to cast the TransactionManager in a component when the classloader isolation is activated

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 3.1
  • Fix Version/s: 5.0.0
  • Component/s: Classloader
  • Security Level: Public
  • Description:
    Hide

    When PEtALS isolates the components classloaders, it is not possible to cast the TransactionManager instance in the component.
    The problem is that the ComponentContext interface defines a method that return an Object, not the TransactionManager, and that the TransactionManager instance is in fact a fractal binding which is a runtime generated class. It is thus not possible to defines the class in the isolated component classloader!
    The result is that it is not possible to use transaction when classloader isolation is activated!

    Show
    When PEtALS isolates the components classloaders, it is not possible to cast the TransactionManager instance in the component. The problem is that the ComponentContext interface defines a method that return an Object, not the TransactionManager, and that the TransactionManager instance is in fact a fractal binding which is a runtime generated class. It is thus not possible to defines the class in the isolated component classloader! The result is that it is not possible to use transaction when classloader isolation is activated!
  • Environment:
    OS:all

Issue Links

Activity

Hide
Victor NOËL added a comment - Thu, 28 May 2015 - 14:12:10 +0200

The problem is simpler than that: TransactionManager is not loaded as part of the common classloader (i.e. the JBI classloader) so in the issue context, it gets loaded twice:

  • once in the container (TransactionManager(cont))
  • once in the component (TransactionManager(comp))

Two loads of a class in two different classloaders are NOT considered the same class by the JVM.
Hence, the impossibility to cast the implementation of TransactionManager(cont) to a variable of type TransactionManager(comp).

The solution is straightforward: the JTA classes should be part of the JBI classloader in Petals. See PETALSESBCONT-323.

Show
Victor NOËL added a comment - Thu, 28 May 2015 - 14:12:10 +0200 The problem is simpler than that: TransactionManager is not loaded as part of the common classloader (i.e. the JBI classloader) so in the issue context, it gets loaded twice:
  • once in the container (TransactionManager(cont))
  • once in the component (TransactionManager(comp))
Two loads of a class in two different classloaders are NOT considered the same class by the JVM. Hence, the impossibility to cast the implementation of TransactionManager(cont) to a variable of type TransactionManager(comp). The solution is straightforward: the JTA classes should be part of the JBI classloader in Petals. See PETALSESBCONT-323.

People

Dates

  • Created:
    Fri, 16 Jul 2010 - 11:06:39 +0200
    Updated:
    Thu, 28 May 2015 - 15:51:13 +0200
    Resolved:
    Thu, 28 May 2015 - 14:35:00 +0200