spring2.5 加了事务注解报错的解决

Spring 2.5 的包和所依赖的包加上 , 配置了数据库连接,  事务控制 , IBATIS 的 SQLMAP 配置 .

当在SERVICE前 加事务标记  @Transactional 后, 启动报错

2011-7-22 22:39:12 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userSRV': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.core.KeyFactory
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
	at java.security.AccessController.doPrivileged(Native Method)



..............................................................





	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.core.KeyFactory
	at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)

上网查得 , 是 CGLIB 的包冲突 ,  因为同时加入了  cglib-2.2.jar    和    cglib-nodep-2.2.jar

删除 cglib-2.2.jar  保留  cglib-nodep-2.2.jar  

错误解决.  事务成功.

相关推荐