net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null

Hibernate JIRA | Tim Motika | 1 decade ago
  1. 0

    [HB-1064] CGLIB classes loaded even when reflection optimizer disabled - Hibernate JIRA

    atlassian.net | 1 year ago
    net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  2. 0

    Running Hibernate from a webapp causes crash on ClassNotFoundException with the cglib in the lib/ non-system path, even when the optimizer is turned off, since it fails, being unable to load net.sf.cglib.reflect.FastClass for some container-related reason (CGLib is probably using Class.forName() which only loads system classes instead of getClass.getClassLoader().loadClass() ). Container behavior aside, Hibernate is breaking encapsulation by loading cglib even when the feature is turned off, then not using it. Suggested fix: Only execute the calls to FastClass.create() conditionally in these three files: ./net/sf/hibernate/persister/AbstractEntityPersister.java:756 ./net/sf/hibernate/type/ComponentType.java:113 ./net/sf/hibernate/util/ReflectHelper.java:156 Related: change usage of Class.forName() to getClass().getClassLoader().loadClass() in CGLIB so that the jar is not pinned to being in the system classpath Hrm. Environmnet is *only* used in these files to check if the optimizer is on. Seems like moving them over to configuration-based checking would be possible. BTW, thanks for the great work on Hibernate! Autopsy: Stack trace, even when the optimizer has been disabled, and Environment.useReflectionOptimizer() returns false. Error: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:208) at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:92) at net.sf.cglib.reflect.FastClass.create(FastClass.java:74) at net.sf.hibernate.persister.AbstractEntityPersister.(AbstractEntityPersister.java:756) at net.sf.hibernate.persister.EntityPersister.(EntityPersister.java:714) at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42) at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:137) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:768) at org.tlala.site.HibernateUtil.start(HibernateUtil.java:183) at org.tlala.site.DBHome.startDB(DBHome.java:86) at org.tlala.site.DBHome.currentSession(DBHome.java:145) at org.tlala.site.DBHome.doBody(DBHome.java:292) at org.tlala.site.DBHome.service(DBHome.java:215) at org.tlala.site.DBHome.service(DBHome.java:176) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96) at com.caucho.server.http.Invocation.service(Invocation.java:315) at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164) at com.caucho.server.TcpConnection.run(TcpConnection.java:139) at java.lang.Thread.run(Thread.java:534) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:411) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:195) ... 20 more Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/reflect/FastClass at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) ... 26 more

    Hibernate JIRA | 1 decade ago | Tim Motika
    net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  3. 0

    Running Hibernate from a webapp causes crash on ClassNotFoundException with the cglib in the lib/ non-system path, even when the optimizer is turned off, since it fails, being unable to load net.sf.cglib.reflect.FastClass for some container-related reason (CGLib is probably using Class.forName() which only loads system classes instead of getClass.getClassLoader().loadClass() ). Container behavior aside, Hibernate is breaking encapsulation by loading cglib even when the feature is turned off, then not using it. Suggested fix: Only execute the calls to FastClass.create() conditionally in these three files: ./net/sf/hibernate/persister/AbstractEntityPersister.java:756 ./net/sf/hibernate/type/ComponentType.java:113 ./net/sf/hibernate/util/ReflectHelper.java:156 Related: change usage of Class.forName() to getClass().getClassLoader().loadClass() in CGLIB so that the jar is not pinned to being in the system classpath Hrm. Environmnet is *only* used in these files to check if the optimizer is on. Seems like moving them over to configuration-based checking would be possible. BTW, thanks for the great work on Hibernate! Autopsy: Stack trace, even when the optimizer has been disabled, and Environment.useReflectionOptimizer() returns false. Error: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:208) at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:92) at net.sf.cglib.reflect.FastClass.create(FastClass.java:74) at net.sf.hibernate.persister.AbstractEntityPersister.(AbstractEntityPersister.java:756) at net.sf.hibernate.persister.EntityPersister.(EntityPersister.java:714) at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42) at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:137) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:768) at org.tlala.site.HibernateUtil.start(HibernateUtil.java:183) at org.tlala.site.DBHome.startDB(DBHome.java:86) at org.tlala.site.DBHome.currentSession(DBHome.java:145) at org.tlala.site.DBHome.doBody(DBHome.java:292) at org.tlala.site.DBHome.service(DBHome.java:215) at org.tlala.site.DBHome.service(DBHome.java:176) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96) at com.caucho.server.http.Invocation.service(Invocation.java:315) at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164) at com.caucho.server.TcpConnection.run(TcpConnection.java:139) at java.lang.Thread.run(Thread.java:534) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:411) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:195) ... 20 more Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/reflect/FastClass at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) ... 26 more

    Hibernate JIRA | 1 decade ago | Tim Motika
    net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I'm using Java3D in my work and then I try save one of it classes (for example, javax.vecmath.Point3d) I see next error: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:236) at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:67) at net.sf.cglib.reflect.FastClass.create(FastClass.java:49) at net.sf.cglib.reflect.FastClass.create(FastClass.java:42) at net.sf.hibernate.type.ComponentType.<init>(ComponentType.java:113) at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:899) at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1041) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:361) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1243) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:333) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:990) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:946) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:889) at com.luxoft.rad.vsp.jdo.DatabaseManager.configureManager(DatabaseManager.java:38) at com.luxoft.rad.vsp.jdo.DatabaseManager.<init>(DatabaseManager.java:26) at com.luxoft.rad.vsp.jdo.AppTest.<init>(AppTest.java:15) at com.luxoft.rad.vsp.jdo.AppTest.main(AppTest.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.intellij.rt.execution.application.AppMain.main(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:373) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:218) ... 23 more Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/reflect/FastClass at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) ... 29 more I'm using next mapping: <class name="TestObj" table="test"> ... <component name="transform" class="javax.vecmath.Point3d"> ... </component> </class> It's work correct if create my own class that extends this class, but I can't create so much classes to save all Java3D objects. Please, tell me, where I wrong.

    Hibernate JIRA | 1 decade ago | Sergey Klimenko
    net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  6. 0

    [HB-1143] Problem with saving some classes (java.lang.NoClassDefFoundError: net/sf/cglib/reflect/FastClass) - Hibernate JIRA

    atlassian.net | 7 months ago
    net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null

  1. bmacedo 8 times, last 2 weeks ago
  2. aldrinleal 1 times, last 1 month ago
  3. ajinkya_w 96 times, last 2 months ago
  4. davidvanlaatum 4 times, last 2 months ago
  5. Handemelindo 2 times, last 3 months ago
17 more registered users
78 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.NoClassDefFoundError

    net/sf/cglib/reflect/FastClass

    at java.lang.ClassLoader.defineClass0()
  2. Java RT
    Method.invoke
    1. java.lang.ClassLoader.defineClass0(Native Method)
    2. java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    3. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    4. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    5. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    6. java.lang.reflect.Method.invoke(Method.java:324)
    6 frames
  3. Code Generation Library
    FastClass.create
    1. net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:411)
    2. net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:195)
    3. net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:92)
    4. net.sf.cglib.reflect.FastClass.create(FastClass.java:74)
    4 frames
  4. net.sf.hibernate
    Configuration.buildSessionFactory
    1. net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:756)
    2. net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:714)
    3. net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
    4. net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)
    5. net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:768)
    5 frames
  5. org.tlala.site
    DBHome.service
    1. org.tlala.site.HibernateUtil.start(HibernateUtil.java:183)
    2. org.tlala.site.DBHome.startDB(DBHome.java:86)
    3. org.tlala.site.DBHome.currentSession(DBHome.java:145)
    4. org.tlala.site.DBHome.doBody(DBHome.java:292)
    5. org.tlala.site.DBHome.service(DBHome.java:215)
    6. org.tlala.site.DBHome.service(DBHome.java:176)
    6 frames
  6. com.caucho.server
    TcpConnection.run
    1. com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
    2. com.caucho.server.http.Invocation.service(Invocation.java:315)
    3. com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
    4. com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
    5. com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)
    6. com.caucho.server.TcpConnection.run(TcpConnection.java:139)
    6 frames
  7. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:534)
    1 frame