返回信息流环境配置:
hibernate是hibernate--3.3.2.ga.jar
spring是2.5.2
jdk是1.7
数据库是:oracle11g
logbak.xml的配置:
<logger name="org.hibernate" additivity="false" level="ERROR"/>
<logger name="org.springframework" level="ERROR"/>
启动警告信息如下:
<2015-8-7 下午12时21分08秒 CST> <Warning> <org.springframework.aop.framework.Cglib2AopProxy> <BEA-000000> <Unable to proxy method [public final org.springframework.orm.hibernate3.HibernateTemplate org.springframework.orm.hibernate3.support.HibernateDaoSupport.getHibernateTemplate()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.>
<2015-8-7 下午12时21分08秒 CST> <Warning> <org.springframework.aop.framework.Cglib2AopProxy> <BEA-000000> <Unable to proxy method [public final void org.springframework.orm.hibernate3.support.HibernateDaoSupport.setSessionFactory(org.hibernate.SessionFactory)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.>
<2015-8-7 下午12时21分08秒 CST> <Warning> <org.springframework.aop.framework.Cglib2AopProxy> <BEA-000000> <Unable to proxy method [public final org.hibernate.SessionFactory org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSessionFactory()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.>
现在增删改查都没问题,但是总是一片一片的报这个警告,不知道为什么,logbak.xml已经设置了ERROR级别,好像不管用,希望大家有知道的能提示一二,感谢!
ps:原来用jdk1.5时没问题,我这次升级jdk到1.7了。
这是一条镜像帖。来源:北邮人论坛 / java / #43430同步于 2015/8/7
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖
启动或者操作数据库时都会报hibernate警告信息
whichday
2015/8/7镜像同步2 回复
订阅后,新回复会通过你的通知中心匿名送达。
2 条回复
以下为度娘转载:
你aop:pointcut声明包含了无法代理的method。
1,是你将声明式事务放到了DAO层,而hibernateDAOSupport里那些final method不能够被代理.
2,自己所写的类中,被事务管理的方法是final型的,也无法被代理。
危害:All calls to this method via a proxy will be routed directly to the proxy.会产生脏数据的,这是spring事物管理报的错,如果不处理数据就很危险了。
原因:spring的事物代理是继承你写的类,然后在你的基础上加事物管理,final的他继承不了,故而无法对其进行事务管理,所以会给出警告,该方法同时也无法进行事务管理!
找到原因了,是因为hibernate的jar包和weblogic里的jar包冲突了,需要在weblogic.xml里设置hibernate的jar优先加载。类似的问题还有log4j的jar包等等。因为中间件也提供了类似的jar包支持,所以需要屏蔽中间件的这些jar包。