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 |