Struts+Hibernate+Spring常见问题

http://wanglihu.iteye.com/blog/1897718

1.java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
缺少asm-3.3.jar
2.java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor
缺少asm-commons-3.3.jar
3.java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
缺少spring-web-3.2.3.RELEASE.jar
4.java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
缺少spring-web-3.2.3.RELEASE.jar
5.java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
缺少spring-web-3.2.3.RELEASE.jar
6.java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
缺少spring-web-3.2.3.RELEASE.jar
7.java.lang.NoClassDefFoundError: org/springframework/context/ConfigurableApplicationContext
缺少spring-context-3.2.3.RELEASE.jar
8.Caused by: java.lang.ClassNotFoundException: org.springframework.beans.FatalBeanException
缺少spring-beans-3.2.3.RELEASE.jar
9.Caused by: java.lang.ClassNotFoundException: org.springframework.core.NestedRuntimeException
缺少spring-core-3.2.3.RELEASE.jar
10.java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
缺少log4j-1.2.16.jar
11. org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/tx]
缺少spring-tx-3.2.3.RELEASE.jar
12.org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [resource/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
缺少aopalliance-1.0.jar 
13.   org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop]
缺少spring-aop-3.2.3.RELEASE.jar
14.java.lang.NoClassDefFoundError: org/springframework/expression/PropertyAccessor
缺少spring-expression-3.2.3.RELEASE.jar
15. org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘ defined in class path resource [resource/applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘: Cannot resolve reference to bean ‘pointcut‘ while setting bean property ‘pointcut‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘pointcut‘: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
缺少spring-aspects-3.2.3.RELEASE.jar、aspectjweaver.jar、aspectjrt.jar
16. org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate4.LocalSessionFactoryBean] for bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean
缺少spring-orm-3.2.3.RELEASE.jar
17. org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
缺少hibernate-commons-annotations-4.0.2.Final.jar
18. org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
缺少dom4j-1.6.1.jar
19.org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger
缺少jboss-logging-3.1.1.GA.jar
20.   org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/SystemException
缺少jboss-transaction-api_1.1_spec-1.0.1.Final.jar
21.   org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/Entity
缺少hibernate-jpa-2.0-api-1.0.1.Final.jar
22. org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath).
hibernate.cfg.xml配置中需添加:
<property name="hibernate.cache.use_second_level_cache">true</property> 
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
23. org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
缺少slf4j-api-1.6.1.jar
24. org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager‘ defined in class path resource [resource/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy
缺少spring-jdbc-3.2.3.RELEASE.jar
25. org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.cjjt.dao.impl.BaseDaoImpl] for bean with name ‘baseDao‘ defined in class path resource [resource/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.cjjt.dao.impl.BaseDaoImpl
26.Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
缺少struts2-spring-plugin-2.3.15.jar
27.org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

28.java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
 问题及解决办法:缺少commons-logging.jar,需要在lib中添加。
 29.NoClassDefFoundError: org/logicalcobwebs/cglib/core/NamingPolicy
 问题及解决办法:默认hibernate4下连接池jar包为较老的proxool-0.8.3.jar。需要换成proxool-0.9.1.jar和proxool-cglib.jar
 30.org.logicalcobwebs.proxool.ShutdownHook - Problem calling "get cause" on IllegalStateException.

问题及解决办法:默认hibernate4下连接池jar包为较老的proxool-0.8.3.jar。需要换成proxool-0.9.1.jar和proxool-cglib.jar

Struts+Hibernate+Spring常见问题,布布扣,bubuko.com

Struts+Hibernate+Spring常见问题

上一篇:Javascript的匿名函数


下一篇:spring mvc源码解析