Spring + OpenJpa 错误,菜鸟求助!!
最近做的项目需要用JPA做统一数据层
我用的JPA实现是Apache的OpenJPA, 在跟Spring结合使用的时候出现了个很低级的问题(求别喷),报错如下
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/classes/application-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/persistence/PersistenceException
.
.
.
.
Caused by: java.lang.NoClassDefFoundError: javax/persistence/PersistenceException
按报错信息应该是找不到类javax.persistence.PersistenceException, 可我引入的JPA包里有这个类的
引入的JPA包有:
-openjpa-1.2.3.jar
-geronimo-jpa_1.0_spec-1.1.2.jar
Spring的版本是2.5.6
spring配置信息如下:
<bean id="dataSource" alt="Spring + OpenJpa 异常,初学者!" />
还是一样啊
弄错了、是ejb3-persistence-1.0.2.GA.jar
[解决办法]