Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1308

Application context fails to start when using a custom class loader is used

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.13.11 (Ingalls SR11)
    • Fix Version/s: 1.13.12 (Ingalls SR12)
    • Component/s: Repositories
    • Labels:
      None

      Description

      When creating a Spring Boot + Spring Data project which contains a JPA repository and in which the application context's class loader is set to be different than the current thread's class loader, the application context fails to start. The following exception is thrown:

      Caused by: java.lang.IllegalArgumentException: interface org.springframework.transaction.interceptor.TransactionalProxy is not visible from class loader
      

      The issue seems to be in the class org.springframework.data.repository.core.support.RepositoryFactorySupport at line 394, where the TransactionalProxy is loaded using the current thread's class loader instead of the application context's class loader. Please see the attached github link for a gradle demo project.

      The work around for this issue is to set the class loader of the current thread to be the same to the class loader of the application context before calling the ctx.refresh(…) method,

        Attachments

          Activity

            People

            • Assignee:
              mp911de Mark Paluch
              Reporter:
              cristic83 Cristian Cioriia
              Last updater:
              Mark Paluch
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: