jsf+spring+hibernate 整合出現的錯誤集合
WARN [main] (Configurator.java:126) - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/Users/algz/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/item/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
解決方案:
ehcache-1.1.jar 包下的ehcache-failsafe.xml 檔案複製到 src 目錄下(新建檔案,複製內容).
二.錯誤資訊提示:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
解決方案:
src 目錄下建立 log4j.properties 檔案(具體內容,詳見log4j配置檔案).
三.錯誤資訊提示:
ERROR [main] (CGLIBLazyInitializer.java:130) - CGLIB Enhancement failed: item.common.hibernate.query.partsum.Partsum
java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
WARN [main] (PojoEntityTuplizer.java:173) - could not create proxy factory for: item.common.hibernate.query.partsum.Partsum
org.hibernate.HibernateException: CGLIB Enhancement failed: item.common.hibernate.query.partsum.Partsum
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
///////////////////////////////////////////////////////////////////////////////////////////
ERROR [main] (CGLIBLazyInitializer.java:130) - CGLIB Enhancement failed: item.common.hibernate.fourm.Fourm
java.lang.NoClassDefFoundError
WARN [main] (PojoEntityTuplizer.java:173) - could not create proxy factory for:item.common.hibernate.fourm.Fourm
org.hibernate.HibernateException: CGLIB Enhancement failed: item.common.hibernate.fourm.Fourm
Caused by: java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
////////////////////////////////////////////////////////////////////////////////////////////
ERROR [main] (CGLIBLazyInitializer.java:130) - CGLIB Enhancement failed: item.common.hibernate.picture
java.lang.NoClassDefFoundError
WARN [main] (PojoEntityTuplizer.java:173) - could not create proxy factory for:item.common.hibernate.picture
org.hibernate.HibernateException: CGLIB Enhancement failed: item.common.hibernate.picture
Caused by: java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
解決方案:
Spring 和 Hibernate 共用的一些 jar 檔案發生了版本衝突, 刪除 WEB-INF/lib/asm-2.2.3.jar 然後重啟 Tomcat.
四.錯誤提示:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
...
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
解決方法:
並不是真正的bean name錯了,也不是找不到他的方法.是asm-2.2.3.jar與asm.jar衝突.
正確的刪除asm-2.2.3.jar方法是到專案的釋出資料夾/WEB-INF/lib中刪除,不能用MyEclipse裡刪除.因為他在釋出時仍沒刪除.