From: <leg...@at...> - 2004-07-05 11:16:53
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Unassigned Priority: Minor Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Mon, 5 Jul 2004 6:35 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-05 11:25:52
|
The following comment has been added to this issue: Author: Tim Motika Created: Mon, 5 Jul 2004 6:45 AM Body: I am able to successfully get around this by putting this in my system CLASSPATH: package net.sf.cglib.reflect; public class FastClass { public static FastClass create( Class c ) { return null; } public Object newInstance() { return null; } } --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13566 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Unassigned Priority: Minor Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Mon, 5 Jul 2004 6:45 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-05 16:38:48
|
Message: The following issue has been closed. Resolver: Gavin King Date: Mon, 5 Jul 2004 11:56 AM CGLIB is used for more than just the reflection optimizer. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Mon, 5 Jul 2004 11:56 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-06 06:50:40
|
The following comment has been added to this issue: Author: Tim Motika Created: Tue, 6 Jul 2004 2:10 AM Body: It still breaks it, and it's still an issue. Rather 1 of these forms of code slop is the excuse: 1. Environment.useReflectionOptimization() which should be in Configuration, but will take time to move there. 2. FastClass.create() which is invoked unnecessarily, which would not matter, but for breaking module encapsulation. 3. FastClass breaks webapp encapsulation by requiring system classpath modifications through Class.forName() most likely. If you are running a webapp and can't modify the system CLASSPATH you are mostly SOL. This wasted 40 minutes of my time doing manual information search, plus other people's time past (it was reported on a forum), and future. Not to mention all the other issues I've tripped over. Thank god for the painfully slow non-searchable web forums. So is 2 minutes more important than hours of other people's time? --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13570 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Tue, 6 Jul 2004 2:10 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-06 07:06:40
|
The following comment has been added to this issue: Author: Tim Motika Created: Tue, 6 Jul 2004 2:25 AM Body: Argh. The evil of punching submit too soon. Sorry. This wasted my time. It wastes others. The problem is unrefactored code. I researched a fix to reduce your time as much as possible and help the Hibernate project. It is still an issue. Fixing it would help people and improve the code. :) --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13571 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Tue, 6 Jul 2004 2:25 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-06 09:21:54
|
The following comment has been added to this issue: Author: Christian Bauer Created: Tue, 6 Jul 2004 4:40 AM Body: You are wrong, Hibernate runs just fine without any modification to the "system classpath", whatever that might be. Stop whining and wasting our time. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13572 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Tue, 6 Jul 2004 4:40 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-25 04:50:56
|
The following comment has been added to this issue: Author: Francois Beausoleil Created: Sun, 25 Jul 2004 12:13 AM Body: Bitten by the same problem... Is there a suggested workaround ? I'm using Hibernate 2.1.4 w/Spring 1.0. Here is the relevant stack trace: 2004-07-25 00:39:36,218 [DEBUG] net.sf.hibernate.cfg.Binder - Mapped property: address -> address, type: string 2004-07-25 00:39:36,234 [INFO ] f.hibernate.util.ReflectHelper - reflection optimizer disabled for: javax.mail.internet.InternetAddress, CodeGenerationException: java.lang.reflect.InvocationTargetException-->null 2004-07-25 00:39:36,250 [ERROR] work.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource [/WEB-INF/applicationContext.xml] of ServletContext: Initialization of bean failed; nested exception is 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.type.ComponentType.<init>(ComponentType.java:113) at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:899) at net.sf.hibernate.cfg.Binder.bindCollectionSecondPass(Binder.java:1205) at net.sf.hibernate.cfg.Binder.bindListSecondPass(Binder.java:1093) at net.sf.hibernate.cfg.Binder$ListSecondPass.secondPass(Binder.java:1396) at net.sf.hibernate.cfg.Binder$SecondPass.doSecondPass(Binder.java:1342) at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:618) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:761) at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:417) at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:355) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:707) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:202) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:172) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:265) at org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:125) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:154) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:95) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3276) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3618) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:754) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) 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 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) 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) ... 37 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) ... 43 more --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13797 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Sun, 25 Jul 2004 12:13 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-25 05:27:55
|
The following comment has been added to this issue: Author: Christian Bauer Created: Sun, 25 Jul 2004 12:49 AM Body: Hibernate runs just fine in a webapp, without you copying any lib into the parent classloaders classpath. You most likely have copied libraries where they shouldn't be (e.g. an old Hibernate2.jar in $TOMCAT/lib). Don't mess with your $TOMCAT/lib, just copy the JDBC driver.jar there and all other classes and libraries you need in your webapp to your WEB-INF/lib and WEB-INF/classes, i.e. in your context classpath. If you still have trouble, start with a fresh unzipped package of Tomcat and repeat this procedure. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13799 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Sun, 25 Jul 2004 12:49 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-27 09:15:41
|
The following comment has been added to this issue: Author: Tim Motika Created: Tue, 27 Jul 2004 4:38 AM Body: Yes, yes, of cousre , my JDBC (HSQLDB.jar) driver has always been in the container-wide lib, and the rest of the jars are in the webapp lib. I posted the bug on the cglib project to no response. Examination of the CGLib code shows that it generates code which uses Class.forName itself. The workaround I use is to explode cglib somewhere into the global/env classpath the container is invoked with, as well as edits of a handful hibernate files to remove the three unnecessary FastClass invocation lines (as well as a few others that are tripped in): ./net/sf/hibernate/CallbackException.java ./net/sf/hibernate/cfg/Environment.java ./net/sf/hibernate/exception/ExceptionUtils.java ./net/sf/hibernate/exception/Nestable.java ./net/sf/hibernate/exception/NestableDelegate.java ./net/sf/hibernate/exception/NestableException.java ./net/sf/hibernate/HibernateException.java ./net/sf/hibernate/Lifecycle.java ./net/sf/hibernate/Session.java ./net/sf/hibernate/hibernate-default.xslt Since the expert here so courteously claims it is a non-issue after such a staggeringly rigorous evaluation, I guess it can only solve problems you aren't actually having. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13816 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Tue, 27 Jul 2004 4:38 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-27 09:33:33
|
The following comment has been added to this issue: Author: Christian Bauer Created: Tue, 27 Jul 2004 4:56 AM Body: "CGLib is probably using Class.forName() which only loads system classes instead of getClass.getClassLoader().loadClass()" is just not correct. There is no difference between the two. If you still insist that you have a unique problem, post exactly the steps you made, starting with "I unzipped tomcat.zip" including "I copied library FOO to BAAR" and then include a simple test that throws the exception. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13820 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Tue, 27 Jul 2004 4:56 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-07-30 22:18:11
|
The following comment has been added to this issue: Author: Francois Beausoleil Created: Fri, 30 Jul 2004 5:41 PM Body: Okay, you wanted a reproduction recipe ? I have one: ant download unzip deploy start-tomcat Even I can run this ;) Anyway, I've reproduced the problem. In the end, maybe it's not Hibernate'= s problem. I have found that the problem is caused if I map javax.mail.int= ernet.InternetAddress. If I don't map that, then, I don't have a problem. BUT, and this is a big but, Hibernate 2.0.2 merrily works along with the sa= me config, and doesn't cough up. To reproduce: Download the reproduction recipe from http://fbeausoleil.ftml.net/hibernate= -2.1.4-repro.tar.bz2 and bunzip2 to your favorite folder. This will create= a hibernate-2.1.4-repro/ folder, under which you'll find the following fil= es and folders: build.xml The build file that can reproduce the problem. instructions.txt The text you are reading now repro-script.txt The detailed reproduction steps src/ Java source, log4j.properties, hibernate.properties and *.hbm.xml war/ WEB-INF/ web.xml, plus mail.jar and activation.jar. The last two JARs did not have a quickly addressible URL, or else I= would have made you download fresh copies. The build file has the following targets: download Downloads the files required to reproduce the bug unzip Unzips the downloaded files clean Deletes built files allclean Deletes all files, including the unzipped libraries compile Compiles the application copy-libs Copies files around to build the app deploy Deploys the src WAR to the target start-tomcat Starts Tomcat zip-repro-script BZ2's the reproduction recipe, ready for attachment DETAILED REPRODUCTION STEPS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D See the repro-script.txt file. DISCUSSION ABOUT THE REPRODUCTION RECIPE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Now that I've reproduced the problem with a fresh Tomcat and Hibernate, I h= ave a better idea what went wrong. I have mapped a javax.mail.internet.InternetAddress as a component: <component name=3D"email" class=3D"javax.mail.internet.InternetAddress"= > <property name=3D"personal" column=3D"personal" type=3D"string" len= gth=3D"80"/> <property name=3D"address" column=3D"address" type=3D"string" lengt= h=3D"240"/> </component> Using Hibernate 2.0.2, this construct was not causing any problems (it was = a composite-element of a list). With 2.1.4, the same construct causes the = problem. Maybe it's me, and I don't really know how to map a composite element... B= ut anyway, InternetAddress is not final, has the proper bean setters and ge= tters and has a no-arg constructor. So, why does this particular class cause problems ? I don't know. Anyway, thanks for a GREAT product, and I wish you luck finding what the pr= oblem is... Bye ! Fran=C3=A7ois --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=3D= comments#action_13884 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components:=20 core Versions: 2.1.3 Assignee:=20 Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Fri, 30 Jul 2004 5:41 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and n= ot in system classpath, as on a webapp) Description: 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 fo= r some container-related reason (CGLib is probably using Class.forName() wh= ich only loads system classes instead of getClass.getClassLoader().loadClas= s() ). Container behavior aside, Hibernate is breaking encapsulation by loading cg= lib 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().loa= dClass() 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 i= s 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.use= ReflectionOptimizer() returns false. Error: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.Invocat= ionTargetException-->null net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTarg= etException-->null =09at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerato= r.java:208) =09at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:92) =09at net.sf.cglib.reflect.FastClass.create(FastClass.java:74) =09at net.sf.hibernate.persister.AbstractEntityPersister.(AbstractEntityPer= sister.java:756) =09at net.sf.hibernate.persister.EntityPersister.(EntityPersister.java:714) =09at net.sf.hibernate.persister.PersisterFactory.createClassPersister(Pers= isterFactory.java:42) =09at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:137= ) =09at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.= java:768) =09at org.tlala.site.HibernateUtil.start(HibernateUtil.java:183) =09at org.tlala.site.DBHome.startDB(DBHome.java:86) =09at org.tlala.site.DBHome.currentSession(DBHome.java:145) =09at org.tlala.site.DBHome.doBody(DBHome.java:292) =09at org.tlala.site.DBHome.service(DBHome.java:215) =09at org.tlala.site.DBHome.service(DBHome.java:176) =09at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet= .java:96) =09at com.caucho.server.http.Invocation.service(Invocation.java:315) =09at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:1= 35) =09at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246= ) =09at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:= 164) =09at com.caucho.server.TcpConnection.run(TcpConnection.java:139) =09at java.lang.Thread.run(Thread.java:534) Caused by: java.lang.reflect.InvocationTargetException =09at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) =09at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.= java:39) =09at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces= sorImpl.java:25) =09at java.lang.reflect.Method.invoke(Method.java:324) =09at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:411) =09at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerato= r.java:195) =09... 20 more Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/reflect/FastClass =09at java.lang.ClassLoader.defineClass0(Native Method) =09at java.lang.ClassLoader.defineClass(ClassLoader.java:537) =09... 26 more --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators= .jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-05 14:25:04
|
The following comment has been added to this issue: Author: Francois Beausoleil Created: Thu, 5 Aug 2004 9:49 AM Body: Okay, Christian, I'm following the quickstart right now. Downloaded Tomcat 4.1.30 and Hibernate 2.1.4. mkdir E:\quickstart jar xf jakarta-tomcat-4.1.30.zip jar xf hibernate-2.1.zip copy hibernate-2.1\lib\hsqldb.jar jakarta-tomcat-4.1.30\common\lib mkdir jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\lib copy hibernate-2.1\hibernate2.jar jakarta-tomcat-4.1.30\webapps\quick= start\WEB-INF\lib copy hibernate-2.1\lib\dom4j-1.4.jar jakarta-tomcat-4.1.30\webapps\qu= ickstart\WEB-INF\lib copy hibernate-2.1\lib\cglib-full-2.0.1.jar jakarta-tomcat-4.1.30\web= apps\quickstart\WEB-INF\lib copy hibernate-2.1\lib\commons-collections-2.1.jar jakarta-tomcat-4.1= .30\webapps\quickstart\WEB-INF\lib copy hibernate-2.1\lib\commons-logging-1.0.3.jar jakarta-tomcat-4.1.3= 0\webapps\quickstart\WEB-INF\lib copy hibernate-2.1\lib\ehcache-0.7.jar jakarta-tomcat-4.1.30\webapps\= quickstart\WEB-INF\lib Edit jakarta-tomcat-4.1.30\conf\server.xml Copied the Context configuration verbatim from step 1.1 of the quicks= tart Edited the Context to use HSQLDB instead: <Context path=3D"/quickstart" docBase=3D"quickstart"> ... <!-- DBCP database connection settings --> <parameter> <name>url</name> <value>jdbc:hsqldb:hsql://localhost</value> </parameter> <parameter> <name>driverClassName</name><value>org.hsqldb.jdbcDriver</value= > </parameter> <parameter> <name>username</name> <value>sa</value> </parameter> <parameter> <name>password</name> <value></value> </parameter> ... </Context> mkdir jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes Edit jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes\hiberna= te.cfg.xml and copied the configuration. Changed the dialect to use HSQL: <property name=3D"dialect">net.sf.hibernate.dialect.HSQLDialect</pr= operty> mkdir jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes\net\sf= \hibernate\examples\quickstart Created jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes\hibe= rnate.cfg.xml Created jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes\net\= sf\hibernate\examples\quickstart\Cat.java Created jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes\Cat.= hbm.xml Those last three were copied verbatim from the quickstart guide. Created jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes\net\= sf\hibernate\examples\quickstart\HibernateUtil.java Copied verbatim from the quickstart guide. Created jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\classes\net\= sf\hibernate\examples\quickstart\HibernateServlet.java package net.sf.hibernate.examples.quickstart; import javax.servlet.*; import javax.servlet.http.*; import net.sf.hibernate.*; import java.io.*; public class HibernateServlet extends HttpServlet { public void init() { try { Session session =3D HibernateUtil.currentSession(); Transaction tx=3D session.beginTransaction(); Cat princess =3D new Cat(); princess.setName("Princess"); princess.setSex('F'); princess.setWeight(7.4f); session.save(princess); tx.commit(); HibernateUtil.closeSession(); } catch (HibernateException e) { e.printStackTrace(); } } public void doGet(HttpServletRequest request, HttpServletResponse respo= nse) throws ServletException { try { response.setContentType("text/plain"); response.getWriter().println("Getting !"); } catch (IOException e) { e.printStackTrace(); } } } Created jakarta-tomcat-4.1.30\webapps\quickstart\WEB-INF\web.xml <?xml version=3D"1.0" encoding=3D"ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>princess-creator</servlet-name> <servlet-class>net.sf.hibernate.examples.quickstart.HibernateServle= t</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>princess-creator</servlet-name> <url-pattern>/princess.html</url-pattern> </servlet-mapping> </web-app> set CATALINA_HOME=3DE:\quickstart\jakarta-tomcat-4.1.30 Started HSQLDB Server Started Tomcat Visited http://localhost:8080/quickstart/princess.html Confirmed that the servlet was working =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Starting from now, I change the config slightly: Shutdown everything (HSQLDB, Tomcat) Delete the HSQLDB db directory Restart the HSQLDB server Create new DB schema like this: create table CAT ( cat_id char(32) primary key, name varchar(16) not null, sex char(1), weight real, personal varchar(80), email varchar(240) ); Add a mapping for E-Mail address to Cat.hbm.xml: <component name=3D"address"> <property name=3D"personal" length=3D"80"/> <property name=3D"address" length=3D"240"/> </component> Update Cat.java to add the following: private InternetAddress address; public void setAddress(InternetAddress address) { this.address =3D address; } public InternetAddress getAddress() { return address; } *** Recompiled *** Restart Tomcat *** Confirm exception received: 2004-08-05 10:12:23 net.sf.hibernate.cfg.Configuration addInputStream GRAVE: Could not configure datastore from input stream net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTarg= etException-->null at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGen= erator.java:208) at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:9= 2) at net.sf.cglib.reflect.FastClass.create(FastClass.java:74) at net.sf.hibernate.type.ComponentType.<init>(ComponentType.java:11= 3) at net.sf.hibernate.cfg.Binder.bindComponent(Binder.java:899) ... Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor= Impl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod= AccessorImpl.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(AbstractClassGen= erator.java:195) ... 35 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) ... 41 more As you can see, I have the exact same exception. Has anyone tried mapping = an InternetAddress ? The quickstart above is using the mail.jar and activation.jar distributed w= ith Tomcat 4.1.30. As noted above, I copied cglib distributed with Hiberna= te 2.1.4. Christian, I've now shown you *twice* that I can get the NoClassDefError. = Both times, I've done it with fresh installs of Tomcat and Hibernate. Maybe you can show me a bit more consideration this time, and tell me where= I'm going wrong ? Is it in my mapping of the InternetAddress ? Am I doin= g something wrong in the quickstart ? Did I forget a step ? Bye, Fran=C3=A7ois --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=3D= comments#action_13940 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: REJECTED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components:=20 core Versions: 2.1.3 Assignee:=20 Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 9:49 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and n= ot in system classpath, as on a webapp) Description: 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 fo= r some container-related reason (CGLib is probably using Class.forName() wh= ich only loads system classes instead of getClass.getClassLoader().loadClas= s() ). Container behavior aside, Hibernate is breaking encapsulation by loading cg= lib 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().loa= dClass() 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 i= s 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.use= ReflectionOptimizer() returns false. Error: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.Invocat= ionTargetException-->null net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTarg= etException-->null =09at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerato= r.java:208) =09at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:92) =09at net.sf.cglib.reflect.FastClass.create(FastClass.java:74) =09at net.sf.hibernate.persister.AbstractEntityPersister.(AbstractEntityPer= sister.java:756) =09at net.sf.hibernate.persister.EntityPersister.(EntityPersister.java:714) =09at net.sf.hibernate.persister.PersisterFactory.createClassPersister(Pers= isterFactory.java:42) =09at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:137= ) =09at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.= java:768) =09at org.tlala.site.HibernateUtil.start(HibernateUtil.java:183) =09at org.tlala.site.DBHome.startDB(DBHome.java:86) =09at org.tlala.site.DBHome.currentSession(DBHome.java:145) =09at org.tlala.site.DBHome.doBody(DBHome.java:292) =09at org.tlala.site.DBHome.service(DBHome.java:215) =09at org.tlala.site.DBHome.service(DBHome.java:176) =09at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet= .java:96) =09at com.caucho.server.http.Invocation.service(Invocation.java:315) =09at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:1= 35) =09at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246= ) =09at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:= 164) =09at com.caucho.server.TcpConnection.run(TcpConnection.java:139) =09at java.lang.Thread.run(Thread.java:534) Caused by: java.lang.reflect.InvocationTargetException =09at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) =09at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.= java:39) =09at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces= sorImpl.java:25) =09at java.lang.reflect.Method.invoke(Method.java:324) =09at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:411) =09at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerato= r.java:195) =09... 20 more Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/reflect/FastClass =09at java.lang.ClassLoader.defineClass0(Native Method) =09at java.lang.ClassLoader.defineClass(ClassLoader.java:537) =09... 26 more --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators= .jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-05 16:16:57
|
Message: The following issue has been reopened. Reopener: Christian Bauer Date: Thu, 5 Aug 2004 11:41 AM Remove mail.jar and activation.jar from Tomcats common/lib/ as a workaround. This is how Hibernate tries to load the InternetAddress component class: return create(type.getClassLoader(),type); The "type" is "InternetAddress.class". Apparently, the classloader that is returned by this call is the Tomcat container classloader, not the context classloader. CGLib has then some problems creating a reflection proxy for this. Juzoas, Gavin, your job. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Reopened Priority: Minor Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 11:41 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-05 20:44:57
|
The following comment has been added to this issue: Author: Christian Bauer Created: Thu, 5 Aug 2004 4:09 PM Body: After talking to Max: public static FastClass create(Class type) { return create(type.getClassLoader(),type); } This in cglib should use the ThreadContext classloader first, then try the classloader of the given argument. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13946 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Reopened Priority: Minor Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 4:09 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-05 21:29:54
|
The following comment has been added to this issue: Author: Max Rydahl Andersen Created: Thu, 5 Aug 2004 4:54 PM Body: okey - time to catch up on the hairy classloader issues (which is actually quite simple to solve ;) The best resource I know of this is acutally a blog entry: http://www.brainopolis.com/roller/comments/kduffey/Weblog/classloader_tips_part_1 Read especially the last sections reagarding thread context classloader and why you need that when dynamically creating/loading classes. The problem is something that has popped up in many opensource projects - e.g. struts, velocity, digester, tomcat have had the same issues (and even worse the JDK it self ;) One should ALWAYS use the current thread context class loader IFF it is set (non-null) and if that fails then use the default classloader of the default class loader! Hibernate actually already have a method that does it mostly correct ;) public static Class classForName(String name) throws ClassNotFoundException { try { return Thread.currentThread().getContextClassLoader().loadClass(name); } catch (Exception e) { return Class.forName(name); } } A better/safer implementation is: public static Class classForName(String name) throws ClassNotFoundException { if(Thread.currentThread().getContextClassLoader()!=null) { try { return Thread.currentThread().getContextClassLoader().loadClass(name); } catch (Exception e) { return Class.forName(name); } } else { Class.forName(name); } } ...I would suggest that cglib adds similar way of loading a class - otherwise if cglib, hibernate or e.g. component classes is located at different levels of the classloader hiearachy then we can get ClassNotFoundExceptions. ...hope that somewhat helps ;) --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13947 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Reopened Priority: Minor Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 4:54 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-05 21:39:54
|
The following comment has been added to this issue: Author: Max Rydahl Andersen Created: Thu, 5 Aug 2004 5:04 PM Body: Google is great ;) http://sourceforge.net/forum/message.php?msg_id=1720229 The original thread were me and my colleague pointed out the exact same problem. I think only hibernate admins can read that posting from the forum so i'm also pasting it here: "The "most correct" way to load a class in either J2EE or J2SE is to follow the pattern defined in the class below. This allows class loading to work properly in a context where there are more than one classloader (such as inside an app server). --- public class ClassUtil { static Class forName(String name) throws ClassNotFoundException { ClassLoader ctxLoader = null; try { ctxLoader = Thread.currentThread() .getContextClassLoader(); return Class.forName(name, true, ctxLoader); } catch(ClassNotFoundException ex) { if(ctxLoader == null) { throw ex; } } catch(SecurityException ex) { } return Class.forName(name); } } --- For the second Class.forName to have any effect, the ClassUtil class should be loaded using the same class loader as the caller of this function. Therefore, this class should be included in the same linkage unit (class path element, .jar file or whatever) as the calling code. And thus; this class is (unfortunately) not really a good candidate to go into a generic class library. At this point, most of the code in the JDK follows this pattern, but there are still many libraries out there that don't. This means that such libraries may not work correctly in a situation with more than one class loader." --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13948 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Reopened Priority: Minor Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 5:04 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 01:56:52
|
The following comment has been added to this issue: Author: Gavin King Created: Thu, 5 Aug 2004 9:21 PM Body: Guys, I disagree, I think CGLIB is right. If I pass in a class Foo, and want to create a FastClass for it, the most obvious place to create that is on the same classloader as Foo, not some other classloader. Yes, it would possibly be a problem for classes loaded as part of the server, in which case, we should just disable the reflection optimizer for them. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13952 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Reopened Priority: Minor Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 9:21 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 02:48:52
|
Message: The following issue has been closed. Resolver: Gavin King Date: Thu, 5 Aug 2004 10:13 PM So, what I did, is just not use FastClass when it causes the exception. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 10:13 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 02:51:54
|
The following comment has been added to this issue: Author: CVS Notification Service Created: Thu, 5 Aug 2004 10:16 PM Body: CVS COMMIT LOG: SUBJECT: [Hibernate-commits] Hibernate2/src/net/sf/hibernate/type ComponentType.java,1.23,1.24 fixed HB-1064 / HB-1143 --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13955 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 10:16 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 02:51:58
|
The following comment has been added to this issue: Author: CVS Notification Service Created: Thu, 5 Aug 2004 10:16 PM Body: CVS COMMIT LOG: SUBJECT: [Hibernate-commits] Hibernate3/src/org/hibernate/type ComponentType.java,1.1,1.2 fixed HB-1064 / HB-1143 --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13961 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 10:16 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 02:51:59
|
The following comment has been added to this issue: Author: CVS Notification Service Created: Thu, 5 Aug 2004 10:16 PM Body: CVS COMMIT LOG: SUBJECT: [Hibernate-commits] Hibernate2/src/net/sf/hibernate/util ReflectHelper.java,1.18,1.19 fixed HB-1064 / HB-1143 --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13959 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 10:16 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 02:51:58
|
The following comment has been added to this issue: Author: CVS Notification Service Created: Thu, 5 Aug 2004 10:16 PM Body: CVS COMMIT LOG: SUBJECT: [Hibernate-commits] Hibernate2/src/net/sf/hibernate/persister AbstractEntityPersister.java,1.41,1.42 fixed HB-1064 / HB-1143 --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13957 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 10:16 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 02:51:59
|
The following comment has been added to this issue: Author: CVS Notification Service Created: Thu, 5 Aug 2004 10:16 PM Body: CVS COMMIT LOG: SUBJECT: [Hibernate-commits] Hibernate3/src/org/hibernate/persister AbstractEntityPersister.java,1.6,1.7 fixed HB-1064 / HB-1143 --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13963 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 10:16 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-06 02:52:02
|
The following comment has been added to this issue: Author: CVS Notification Service Created: Thu, 5 Aug 2004 10:16 PM Body: CVS COMMIT LOG: SUBJECT: [Hibernate-commits] Hibernate3/src/org/hibernate/util ReflectHelper.java,1.2,1.3 fixed HB-1064 / HB-1143 --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_13965 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Thu, 5 Aug 2004 10:16 PM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <leg...@at...> - 2004-08-08 10:12:29
|
The following comment has been added to this issue: Author: Tim Motika Created: Sun, 8 Aug 2004 5:37 AM Body: Thank you. My error. Class.forName does behave differently than I initially thought. This should fix some of it on the Hibernate end, though my attempt at removing FastClass invocation simply resulted in different stack traces until I dumped not only CGLIB, but a few other Hibernate classes, mostly exception-related, into $CLASSPATH as well: ./hibernate/CallbackException.java ./hibernate/cfg/Environment.java ./hibernate/exception/ExceptionUtils.java ./hibernate/exception/Nestable.java ./hibernate/exception/NestableDelegate.java ./hibernate/exception/NestableException.java ./hibernate/HibernateException.java ./hibernate/Lifecycle.java ./hibernate/Session.java The stack traces are fairly undecipherable as to the Class causing the problem due to chained loading. Francois was having problems persisting javax.mail.InternetAddress, my persisted classes were coming from $CLASSPATH since the file base is large and broken into several different locations (classes should not have to be pinned to the webapp to have a working system). I think the basic issue, is that such persisteed classes have the container's ClassLoader, which can find neither CGLIB nor Hibernate. CGLIB or less likely Hibernate is using the persisted class's Class for class lookup somewhere and choking. This is posted mostly as an FYI for those who are still having problems. Tim --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064?page=comments#action_14004 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1064 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1064 Summary: CGLIB classes loaded even when reflection optimizer disabled Type: Bug Status: Closed Priority: Minor Resolution: FIXED Original Estimate: 5 minutes Time Spent: Unknown Remaining: 5 minutes Project: Hibernate2 Components: core Fix Fors: 3.0 alpha 2.1.6 Versions: 2.1.3 Assignee: Gavin King Reporter: Tim Motika Created: Mon, 5 Jul 2004 6:35 AM Updated: Sun, 8 Aug 2004 5:37 AM Environment: All; ( win32 resin / issue when cglib dynamically loaded and not in system classpath, as on a webapp) Description: 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 --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |