Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-9251

Use context class loader for loading JSON mapping target classes

    XMLWordPrintable

Details

    • Bug Report
    • Resolution: Fixed
    • L3 - Default
    • 7.10.0, 7.10.0-alpha3
    • None
    • spin
    • None

    Description

      Related to https://github.com/camunda/camunda-spin/pull/19
      The current implementation is problematic if using Camunda BPM together with Spring Boot's Developer Tools (and possibly other non-trivial classloading environments). If the class to be mapped from JSON already was loaded from another classloader you end up with a ClassCastException like this:

      java.lang.ClassCastException: com.example.MyClassMappedFromJson cannot be cast to com.example.MyClassMappedFromJson

      This is the case if using the Spring Boot Developer Tools. Per default classes in your current project (MyClassMappedFromJson from the example) are loaded with a RestartClassLoader while Class.forName(typeIdentifer) loads the class a second time with the current class loader which produces this incompatiblity.

      Always using the context class loader fixes the problem: https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/reference/htmlsingle/#using-boot-devtools-known-restart-limitations

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Issue Links

            Activity

              People

                yana.vasileva Yana Vasileva
                yana.vasileva Yana Vasileva
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Salesforce