记录整合中缺少 JAR 文件引起的异常
版本 Spring 3+ Hibernate 4+ JPA
1、Exception in thread "main" 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.0.RELEASE.jar
2、Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.aop.config.internalAutoProxyCreator‘: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
缺少:aopalliance-1.0.jar
3、 Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
缺少:aspectjrt-1.6.9.jar
4、 nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
缺少:spring-orm-3.2.0.RELEASE.jar
5、java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException
缺少:spring-tx-3.2.0.RELEASE.jar
6、nested exception is java.lang.ClassNotFoundException: com.alibaba.druid.pool.DruidDataSource
缺少:druid-0.2.11.jar
7、java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/lookup/DataSourceLookup
缺少:spring-jdbc-3.2.0.RELEASE.jar
8、Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration, and chosen PersistenceUnitInfo does not specify a provider class name either
加上:
<property
name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
/>
</property>
9、Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger
缺少:jboss-logging-3.1.0.GA.jar
10、nested exception is java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence
缺少:hibernate-entitymanager-4.1.7.Final.jar
11、nested exception is java.lang.NoClassDefFoundError: org/hibernate/proxy/EntityNotFoundDelegate
缺少:hibernate-core-4.1.7.Final.jar
12、nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider
缺少:hibernate-commons-annotations-4.0.1.Final.jar