在使用idea工具开发时,你建文件的时候会根据你的选项下载一些包,但是有时候不全
在我引用jpa的jar包后运行的时候报错:
然后去网上查了一下,是缺少相应的jar包:
以下是相应jar缺失出现的异常(仅供参考):
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
从相关网站转载的(转载地址):http://www.cnblogs.com/xiaota/p/3728821.html