net.sf.cglib.CodeGenerationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I have some persistent classes, which cannot be instrumented with CGLIB reflection optimizer. In Hibernate versions prior to 2.1beta4 I've got the following correct log messages and everything worked fine: --- 14:26:48,230 INFO [:] SessionFactoryImpl:109 - building session factory 14:26:57,507 INFO [:] ReflectHelper:328 - reflection optimizer disabled for: si.marand.maf.server.jastreb.party.module.entity.PersonEntity, NullPointerException: null 14:26:59,175 INFO [:] ReflectHelper:328 - reflection optimizer disabled for: si.marand.maf.server.jastreb.party.module.entity.BankEntity, NullPointerException: null 14:27:06,349 INFO [:] SessionFactoryObjectFactory:86 - Factory name: maf-server-hibernate-sessionFactory --- But in version 2.1beta4 is instead of this in the same phase of startup process thrown an exception, which stops application. The excerption from log it here: --- 12:18:51,464 ERROR [:] LazyInitializer:62 - CGLIB Enhancement failed net.sf.cglib.CodeGenerationException at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:200) at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:186) at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:181) at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:222) at net.sf.cglib.Enhancer.enhance(Enhancer.java:149) at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:52) at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:754) at net.sf.hibernate.persister.NormalizedEntityPersister.<init>(NormalizedEntityPersister.java:737) at net.sf.hibernate.persister.PersisterFactory.create(PersisterFactory.java:63) at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:132) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:660) ... --- Besides of this bug it seems, that hibernate.cglib.use_reflection_optimizer setting is ignored in beta4 and "true" is allways used as it's value. Dominik
    via by Dominik Roblek,
  • I have some persistent classes, which cannot be instrumented with CGLIB reflection optimizer. In Hibernate versions prior to 2.1beta4 I've got the following correct log messages and everything worked fine: --- 14:26:48,230 INFO [:] SessionFactoryImpl:109 - building session factory 14:26:57,507 INFO [:] ReflectHelper:328 - reflection optimizer disabled for: si.marand.maf.server.jastreb.party.module.entity.PersonEntity, NullPointerException: null 14:26:59,175 INFO [:] ReflectHelper:328 - reflection optimizer disabled for: si.marand.maf.server.jastreb.party.module.entity.BankEntity, NullPointerException: null 14:27:06,349 INFO [:] SessionFactoryObjectFactory:86 - Factory name: maf-server-hibernate-sessionFactory --- But in version 2.1beta4 is instead of this in the same phase of startup process thrown an exception, which stops application. The excerption from log it here: --- 12:18:51,464 ERROR [:] LazyInitializer:62 - CGLIB Enhancement failed net.sf.cglib.CodeGenerationException at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:200) at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:186) at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:181) at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:222) at net.sf.cglib.Enhancer.enhance(Enhancer.java:149) at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:52) at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:754) at net.sf.hibernate.persister.NormalizedEntityPersister.<init>(NormalizedEntityPersister.java:737) at net.sf.hibernate.persister.PersisterFactory.create(PersisterFactory.java:63) at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:132) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:660) ... --- Besides of this bug it seems, that hibernate.cglib.use_reflection_optimizer setting is ignored in beta4 and "true" is allways used as it's value. Dominik
    via by Dominik Roblek,
    • net.sf.cglib.CodeGenerationException at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:200) at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:186) at net.sf.cglib.ReflectUtils.newInstance(ReflectUtils.java:181) at net.sf.cglib.Enhancer.enhanceHelper(Enhancer.java:222) at net.sf.cglib.Enhancer.enhance(Enhancer.java:149) at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:52) at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:754) at net.sf.hibernate.persister.NormalizedEntityPersister.<init>(NormalizedEntityPersister.java:737) at net.sf.hibernate.persister.PersisterFactory.create(PersisterFactory.java:63) at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:132) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:660)
    No Bugmate found.