java.lang.IllegalArgumentException: No visible constructors in interface eg.IFather

Hibernate JIRA | Chris Hane | 1 decade ago
  1. 0

    Is it legal to map a many-to-one class to an interface. I have done this with the father property (in the attached example), however, I am receiving errors when I try to load records where the parent property is not null. I have attached a set of files that demonstrate the error I am getting. To use: 1. run the sql script to build files and populate data Note: I'm using MySQL so you might have to change for a different DB 2. Change eg.test configuration properites to reflect your DB setup 3. Run eg.test Everything should work fine and "Detail B1 - F3" should be printed to the output 4. Now in eg.test, change the configuration to use eg.IFather instead of eg.Father 5. In IDetail, change the m-1 father property from eg.Father to eg.IFather 6. Re-run and you will get this error. Exception in thread "main" java.lang.IllegalArgumentException: No visible constructors in interface eg.IFather at net.sf.cglib.EnhancerGenerator.<init>(EnhancerGenerator.java:128) at net.sf.cglib.Enhancer.enhanceClassHelper(Enhancer.java:224) at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:206) at net.sf.cglib.Enhancer.enhance(Enhancer.java:162) at net.sf.cglib.Enhancer.enhance(Enhancer.java:139) at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:26) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901) at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710) at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48) at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at com.test.main(test.java:39) rethrown as net.sf.hibernate.HibernateException: CGLIB Enhancement failed: No visible constructors in interface eg.IFather at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:37) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901) at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710) at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48) at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at com.test.main(test.java:39) rethrown as net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem: CGLIB Enhancement failed: No visible constructors in interface eg.IFather at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:59) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at eq.test.main(test.java:43) Chris....

    Hibernate JIRA | 1 decade ago | Chris Hane
    java.lang.IllegalArgumentException: No visible constructors in interface eg.IFather
  2. 0

    Is it legal to map a many-to-one class to an interface. I have done this with the father property (in the attached example), however, I am receiving errors when I try to load records where the parent property is not null. I have attached a set of files that demonstrate the error I am getting. To use: 1. run the sql script to build files and populate data Note: I'm using MySQL so you might have to change for a different DB 2. Change eg.test configuration properites to reflect your DB setup 3. Run eg.test Everything should work fine and "Detail B1 - F3" should be printed to the output 4. Now in eg.test, change the configuration to use eg.IFather instead of eg.Father 5. In IDetail, change the m-1 father property from eg.Father to eg.IFather 6. Re-run and you will get this error. Exception in thread "main" java.lang.IllegalArgumentException: No visible constructors in interface eg.IFather at net.sf.cglib.EnhancerGenerator.<init>(EnhancerGenerator.java:128) at net.sf.cglib.Enhancer.enhanceClassHelper(Enhancer.java:224) at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:206) at net.sf.cglib.Enhancer.enhance(Enhancer.java:162) at net.sf.cglib.Enhancer.enhance(Enhancer.java:139) at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:26) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901) at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710) at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48) at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at com.test.main(test.java:39) rethrown as net.sf.hibernate.HibernateException: CGLIB Enhancement failed: No visible constructors in interface eg.IFather at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:37) at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790) at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728) at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62) at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971) at net.sf.hibernate.loader.Loader.doFind(Loader.java:196) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42) at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392) at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901) at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710) at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48) at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at com.test.main(test.java:39) rethrown as net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem: CGLIB Enhancement failed: No visible constructors in interface eg.IFather at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:59) at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153) at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49) at eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>) at eq.test.main(test.java:43) Chris....

    Hibernate JIRA | 1 decade ago | Chris Hane
    java.lang.IllegalArgumentException: No visible constructors in interface eg.IFather
  3. 0

    [WICKET-1130] Injection of Bound Instance Fails with Exception - ASF JIRA

    apache.org | 1 year ago
    java.lang.IllegalArgumentException: No visible constructors in class foo.SomeSingleton
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [WICKET-1130] Injection of Bound Instance Fails with Exception - ASF JIRA

    apache.org | 1 year ago
    java.lang.IllegalArgumentException: No visible constructors in class foo.SomeSingleton

    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

      No visible constructors in interface eg.IFather

      at net.sf.cglib.EnhancerGenerator.<init>()
    2. net.sf.cglib
      Enhancer.enhance
      1. net.sf.cglib.EnhancerGenerator.<init>(EnhancerGenerator.java:128)
      2. net.sf.cglib.Enhancer.enhanceClassHelper(Enhancer.java:224)
      3. net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:206)
      4. net.sf.cglib.Enhancer.enhance(Enhancer.java:162)
      5. net.sf.cglib.Enhancer.enhance(Enhancer.java:139)
      5 frames
    3. net.sf.hibernate
      CGLIBLazyInitializer.intercept
      1. net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxy(CGLIBLazyInitializer.java:26)
      2. net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1790)
      3. net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728)
      4. net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62)
      5. net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971)
      6. net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
      7. net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587)
      8. net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
      9. net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392)
      10. net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901)
      11. net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710)
      12. net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:48)
      13. net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyInitializer.java:55)
      14. net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitializer.java:153)
      15. net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:49)
      15 frames
    4. FitNesse
      DetailB$$EnhancedByCGLIB$$0.getTestValue
      1. eg.DetailB$$EnhancedByCGLIB$$0.getTestValue(<generated>)
      1 frame
    5. finagle-core
      test.main
      1. com.test.main(test.java:39)
      1 frame