java.lang.IllegalArgumentException: interface org.springframework.data.jpa.repository.support.CrudMethodMetadata is not visible from class loader

Spring JIRA | Assen Sharlandjiev | 1 year ago
  1. 0

    {{CrudMethodMetadata.getLockMetadataProvider(…)}} should use the bean class loader when obtaining the proxy. {{RepositoryFactorySupport}} supports injecting the correct class loader trough {{RepositoryFactorySupport.setBeanClassLoader(…)}}. When using the {{JpaRepositoryFactory}} to obtain a {{JpaRepository}} implementation in my OSGI bundle, I end up with the following exception: {code:java} @Override public PersonRepository getObject() throws Exception { final JpaRepositoryFactory factory = new JpaRepositoryFactory(entityManager); try { final Bundle bundle = FrameworkUtil.getBundle(PersonRepository.class); final ClassLoader classLoader = bundle.adapt(BundleWiring.class).getClassLoader(); factory.setBeanClassLoader(classLoader); final PersonRepository repository = factory.getRepository(PersonRepository.class); return repository; } catch (final Exception e) { LOG.error(null, e); throw new BeanCreationException(null, e); } } {code} Exception: {code} 2015-11-05 13:35:11,740 | ERROR | h for user karaf | PersonRepositoryFactory | 145 - com.effortel.core.data.example - 1.0.0.SNAPSHOT | java.lang.IllegalArgumentException: interface org.springframework.data.jpa.repository.support.CrudMethodMetadata is not visible from class loader at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581)[:1.8.0_65] at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)[:1.8.0_65] at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)[:1.8.0_65] at java.lang.reflect.WeakCache.get(WeakCache.java:127)[:1.8.0_65] at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)[:1.8.0_65] at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)[:1.8.0_65] at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:121) at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:111) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:96) at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor.getLockMetadataProvider(CrudMethodMetadataPostProcessor.java:74) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:72) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:164) at com.effortel.core.data.example.repository.PersonRepositoryFactory.getObject(PersonRepositoryFactory.java:53) {code}

    Spring JIRA | 1 year ago | Assen Sharlandjiev
    java.lang.IllegalArgumentException: interface org.springframework.data.jpa.repository.support.CrudMethodMetadata is not visible from class loader
  2. 0

    {{CrudMethodMetadata.getLockMetadataProvider(…)}} should use the bean class loader when obtaining the proxy. {{RepositoryFactorySupport}} supports injecting the correct class loader trough {{RepositoryFactorySupport.setBeanClassLoader(…)}}. When using the {{JpaRepositoryFactory}} to obtain a {{JpaRepository}} implementation in my OSGI bundle, I end up with the following exception: {code:java} @Override public PersonRepository getObject() throws Exception { final JpaRepositoryFactory factory = new JpaRepositoryFactory(entityManager); try { final Bundle bundle = FrameworkUtil.getBundle(PersonRepository.class); final ClassLoader classLoader = bundle.adapt(BundleWiring.class).getClassLoader(); factory.setBeanClassLoader(classLoader); final PersonRepository repository = factory.getRepository(PersonRepository.class); return repository; } catch (final Exception e) { LOG.error(null, e); throw new BeanCreationException(null, e); } } {code} Exception: {code} 2015-11-05 13:35:11,740 | ERROR | h for user karaf | PersonRepositoryFactory | 145 - com.effortel.core.data.example - 1.0.0.SNAPSHOT | java.lang.IllegalArgumentException: interface org.springframework.data.jpa.repository.support.CrudMethodMetadata is not visible from class loader at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581)[:1.8.0_65] at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)[:1.8.0_65] at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)[:1.8.0_65] at java.lang.reflect.WeakCache.get(WeakCache.java:127)[:1.8.0_65] at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)[:1.8.0_65] at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)[:1.8.0_65] at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:121) at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:111) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:96) at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor.getLockMetadataProvider(CrudMethodMetadataPostProcessor.java:74) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:72) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:164) at com.effortel.core.data.example.repository.PersonRepositoryFactory.getObject(PersonRepositoryFactory.java:53) {code}

    Spring JIRA | 1 year ago | Assen Sharlandjiev
    java.lang.IllegalArgumentException: interface org.springframework.data.jpa.repository.support.CrudMethodMetadata is not visible from class loader
  3. 0

    Weblogic 12 + Spring Data JPA + CDI issues

    Stack Overflow | 10 months ago | Tassos G.
    java.lang.IllegalArgumentException: interface org.springframework.data.jpa.repository.support.CrudMethodMetadata is not visible from class loader
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Eclipse Community Forums: Rich Client Platform (RCP) » RCP + spring

    eclipse.org | 1 year ago
    java.lang.IllegalArgumentException: interface org.springframework.security.providers.rcp.RemoteAuthenticationManager is not visible from class loader
  6. 0

    JPA with hibernate with spring DM

    Google Groups | 9 years ago | ouertani slim
    java.lang.IllegalArgumentException: interface org.springframework.beans.factory.xml.NamespaceHandlerResolver is not visible from class loader

    17 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      interface org.springframework.data.jpa.repository.support.CrudMethodMetadata is not visible from class loader

      at java.lang.reflect.Proxy$ProxyClassFactory.apply()
    2. Java RT
      Proxy.newProxyInstance
      1. java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581)[:1.8.0_65]
      2. java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)[:1.8.0_65]
      3. java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)[:1.8.0_65]
      4. java.lang.reflect.WeakCache.get(WeakCache.java:127)[:1.8.0_65]
      5. java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)[:1.8.0_65]
      6. java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)[:1.8.0_65]
      6 frames
    3. Spring AOP
      ProxyFactory.getProxy
      1. org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:121)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:111)
      3. org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:96)
      3 frames
    4. Spring Data JPA
      JpaRepositoryFactory.getTargetRepository
      1. org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor.getLockMetadataProvider(CrudMethodMetadataPostProcessor.java:74)
      2. org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:72)
      2 frames
    5. Spring Data Core
      RepositoryFactorySupport.getRepository
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185)
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:164)
      2 frames
    6. com.effortel.core
      PersonRepositoryFactory.getObject
      1. com.effortel.core.data.example.repository.PersonRepositoryFactory.getObject(PersonRepositoryFactory.java:53)
      1 frame