Uploaded image for project: 'Spring XD'
  1. Spring XD
  2. XD-3155

MessageBusSupport loads classes using the wrong ClassLoader

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.2 GA
    • Component/s: None
    • Labels:
      None

      Description

      Use Spring XD modules with Spring Boot devtools the following SpEL errors occur:

      Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): Method call: Method accept(demo.Vote) cannot be found on demo.CounterApplication$$EnhancerBySpringCGLIB$$8b6c5177 type
          at org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod(MethodReference.java:211)
          at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:125)
          at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
          at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:342)
      ...
      

      The root cause of the error is that SpEL is using a different classloader to compare argument times to the one that loaded the object.

      The actual incoming object is loaded via MessageBusSupport which is calling Class.forName. If ClassUtils.forName is used instead then the context classloader is used and everything appears to work.

        Attachments

          Activity

            People

            Assignee:
            mbogoevici Marius Bogoevici
            Reporter:
            pwebb Phil Webb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: