|
From: Colin S. <col...@ex...> - 2003-12-11 17:45:52
|
Colin Sampaleanu wrote: > jürgen höller [werk3AT] wrote: > >> Everybody, >> >> Hibernate 2.1 final with CGLIB2 underneath has just been released. >> This poses the question whether we should still release our 1.0 M4 >> with CGLIB1 support. Of course, our current codebase works nicely >> with Hibernate 2.1 as long as you don't use CGLIB-based AOP proxies >> (i.e. proxy full target objects instead of just interfaces), so we >> don't *have* to update immediately. >> >> >> > Hmm, maybe this was once the case, but I am not sure it is so easy any > longer. I tried dropping in Hibernate 2.1 final (with cglib2). > However, when using TransactionProxyFactoryBean, which no longer has > the old ProxyInterfacesOnly boolean option (which used to default to > true, and used a JDK proxy in the true case instead of cglib proxy), I > now get an exception > > java.lang.NoClassDefFoundError: > org/springframework/aop/framework/OptimizedCglib1AopProxy > at > org.springframework.transaction.interceptor.TransactionProxyFactoryBean.afterPropertiesSet(TransactionProxyFactoryBean.java:167) > > at > org.springframework.beans.factory.support.AbstractBeanFactory.callLifecycleMethodsIfNecessary(AbstractBeanFactory.java:1011) > > at > org.springframework.beans.factory.support.AbstractBeanFactory.createBean(AbstractBeanFactory.java:539) > > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:186) > > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:184) > > at > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284) > > at > org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:107) > > > The offending line is: > > ProxyFactory proxyFactory = new ProxyFactory(); > > Of course, ProxyFactory extends AdvisedSupport, which directly > references OptimizedCglib1AopProxy. > Ok, I got this to work, by also adding the cglib1 jar file, which allows OptimizedCglib1AopProxy to be loaded when referenced by AdvisedSupport. I used the cglib 1 jar _without_ the embedded ASM support. I think there would be a potential failure if the one with ASM (1.3) in it was used, since it would conflic with the ASM 1.4 needed for cglib2. cglib 1 is here in this case only to allow the loading, and will fail if a spring cglib1 proxy were ever attempted to be used. In any case, I am very much for moving to cglib2/Hibernate 2.1 final in Spring itself, so stuff like this doesn't have to be done any longer. |