java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object

Spring JIRA | Petar Tahchiev | 3 years ago
  1. 0

    Hi guys, according to comments on DATAREST-72 and DATAREST-196 I attach a sample project that reproduces the problem. Once again, I have a base repository called BaseEntityRepository<T, PK extends Serializable> and it is marked as (exported=false), but I get this error: {code} Caused by: java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:221) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:67) at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:146) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:39) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getEntityInformation(RepositoryFactoryBeanSupport.java:122) at org.springframework.data.repository.support.Repositories.getRepoInfoFor(Repositories.java:180) at org.springframework.data.repository.support.Repositories.getRepositoryInformationFor(Repositories.java:129) at org.springframework.data.rest.core.mapping.ResourceMappings.populateCache(ResourceMappings.java:98) at org.springframework.data.rest.core.mapping.ResourceMappings.<init>(ResourceMappings.java:79) at org.springframework.data.rest.core.mapping.ResourceMappings.<init>(ResourceMappings.java:60) at org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.resourceMappings(RepositoryRestMvcConfiguration.java:345) at com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8.CGLIB$resourceMappings$35(<generated>) at com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8$$FastClassByCGLIB$$317e1769.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:286) at com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8.resourceMappings(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:160) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1025) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance {code} To reproduce, please unzip the zip file, then cd test, mvn clean install, then cd mvc and run mvn jetty:run.. the application will not start because of the exception I have described.

    Spring JIRA | 3 years ago | Petar Tahchiev
    java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object
  2. 0

    Hi guys, according to comments on DATAREST-72 and DATAREST-196 I attach a sample project that reproduces the problem. Once again, I have a base repository called BaseEntityRepository<T, PK extends Serializable> and it is marked as (exported=false), but I get this error: {code} Caused by: java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:221) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:67) at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:146) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:39) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getEntityInformation(RepositoryFactoryBeanSupport.java:122) at org.springframework.data.repository.support.Repositories.getRepoInfoFor(Repositories.java:180) at org.springframework.data.repository.support.Repositories.getRepositoryInformationFor(Repositories.java:129) at org.springframework.data.rest.core.mapping.ResourceMappings.populateCache(ResourceMappings.java:98) at org.springframework.data.rest.core.mapping.ResourceMappings.<init>(ResourceMappings.java:79) at org.springframework.data.rest.core.mapping.ResourceMappings.<init>(ResourceMappings.java:60) at org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.resourceMappings(RepositoryRestMvcConfiguration.java:345) at com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8.CGLIB$resourceMappings$35(<generated>) at com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8$$FastClassByCGLIB$$317e1769.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:286) at com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8.resourceMappings(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:160) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1025) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance {code} To reproduce, please unzip the zip file, then cd test, mvn clean install, then cd mvc and run mvn jetty:run.. the application will not start because of the exception I have described.

    Spring JIRA | 3 years ago | Petar Tahchiev
    java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object
  3. 0

    Generic class Implementation for a SpringData & QueryDSL Service

    Stack Overflow | 12 months ago | Mario Garrido
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'regionServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring JpaRepository using generic entity

    Stack Overflow | 10 months ago | nicola
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genericDao': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object
  6. 0

    Spring Data: Not an managed type: class java.lang.Object

    Stack Overflow | 7 months ago | Em Ae
    springframework.beans.factory.BeanCreationException: Error creating bean with name 'TableNameService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.xxx.xxx.db.BaseRepository com.xxx.xxx.tablename.TableNameService.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object
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

    Not an managed type: class java.lang.Object

    at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType()
  2. org.hibernate.jpa
    MetamodelImpl.managedType
    1. org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:221)
    1 frame
  3. Spring Data JPA
    JpaRepositoryFactory.getEntityInformation
    1. org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:67)
    2. org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65)
    3. org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:146)
    4. org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:39)
    4 frames
  4. Spring Data Core
    Repositories.getRepositoryInformationFor
    1. org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getEntityInformation(RepositoryFactoryBeanSupport.java:122)
    2. org.springframework.data.repository.support.Repositories.getRepoInfoFor(Repositories.java:180)
    3. org.springframework.data.repository.support.Repositories.getRepositoryInformationFor(Repositories.java:129)
    3 frames
  5. Spring Data REST - Core
    ResourceMappings.<init>
    1. org.springframework.data.rest.core.mapping.ResourceMappings.populateCache(ResourceMappings.java:98)
    2. org.springframework.data.rest.core.mapping.ResourceMappings.<init>(ResourceMappings.java:79)
    3. org.springframework.data.rest.core.mapping.ResourceMappings.<init>(ResourceMappings.java:60)
    3 frames
  6. Spring Data REST - WebMVC
    RepositoryRestMvcConfiguration.resourceMappings
    1. org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.resourceMappings(RepositoryRestMvcConfiguration.java:345)
    1 frame
  7. com.test.config
    RestConfig$$EnhancerByCGLIB$$ddea48b8$$FastClassByCGLIB$$317e1769.invoke
    1. com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8.CGLIB$resourceMappings$35(<generated>)
    2. com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8$$FastClassByCGLIB$$317e1769.invoke(<generated>)
    2 frames
  8. Spring Core
    MethodProxy.invokeSuper
    1. org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    1 frame
  9. Spring Context
    ConfigurationClassEnhancer$BeanMethodInterceptor.intercept
    1. org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:286)
    1 frame
  10. com.test.config
    RestConfig$$EnhancerByCGLIB$$ddea48b8.resourceMappings
    1. com.test.config.RestConfig$$EnhancerByCGLIB$$ddea48b8.resourceMappings(<generated>)
    1 frame
  11. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:601)
    4 frames
  12. Spring Beans
    AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod
    1. org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:160)
    2. org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1025)
    3 frames