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 |