0 0

JPA EntityManager创建失败0

在集成SpringDm 与OpenJPA时,提示以下错误信息

6234  myUnit  INFO   [EclipseGeminiBlueprintExtenderThread-6] openjpa.Runtime - Starting OpenJPA 2.2.0
Oct 24, 2012 3:31:08 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3481c06f: defining beans [client,jpaDao]; root of factory hierarchy
Oct 24, 2012 3:31:08 PM org.eclipse.gemini.blueprint.extender.internal.support.DefaultOsgiBundleApplicationContextListener onOsgiApplicationEvent
SEVERE: Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=jpatest, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in URL [bundleentry://31.fwk1968255290/META-INF/spring/test.xml]: Invocation of init method failed; nested exception is <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
com.huadainfo.studio.model.Contcat".
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:60)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:325)
at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
at java.lang.Thread.run(Thread.java:722)
Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
com.huadainfo.studio.model.Contcat".
at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:115)
at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:314)
at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:376)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:517)
at $Proxy9.createEntityManager(Unknown Source)
at com.huadainfo.studio.jpa.dao.impl.JpaDaoImpl.addObject(JpaDaoImpl.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy10.addObject(Unknown Source)
at org.jpa.test.JPAtest.test(JPAtest.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 14 more

Oct 24, 2012 3:31:08 PM org.eclipse.gemini.blueprint.context.support.AbstractOsgiBundleApplicationContext unpublishContextAsOsgiService
INFO: Application Context service already unpublished
Oct 24, 2012 3:31:08 PM org.eclipse.gemini.blueprint.extender.internal.support.DefaultOsgiBundleApplicationContextListener onOsgiApplicationEvent
INFO: Application context succesfully closed (OsgiBundleXmlApplicationContext(bundle=jpatest, config=osgibundle:/META-INF/spring/*.xml))
Oct 24, 2012 3:31:08 PM org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor fail
SEVERE: Unable to create application context for [jpatest], unsatisfied dependencies: none
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in URL [bundleentry://31.fwk1968255290/META-INF/spring/test.xml]: Invocation of init method failed; nested exception is <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
com.huadainfo.studio.model.Contcat".
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:60)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:325)
at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
at java.lang.Thread.run(Thread.java:722)
Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
com.huadainfo.studio.model.Contcat".
at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:115)
at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:314)
at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:376)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:517)
at $Proxy9.createEntityManager(Unknown Source)
at com.huadainfo.studio.jpa.dao.impl.JpaDaoImpl.addObject(JpaDaoImpl.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy10.addObject(Unknown Source)
at org.jpa.test.JPAtest.test(JPAtest.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 14 more

2012年10月24日 15:34

1个答案 按时间排序 按投票排序

0 0

SEVERE: Unable to create application context for [jpatest], unsatisfied dependencies: none
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in URL [bundleentry://31.fwk1968255290/META-INF/spring/test.xml]: Invocation of init method failed; nested exception is <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
com.huadainfo.studio.model.Contcat".


请参考
http://simen-net.iteye.com/blog/621925 不会的问题可以为他 他会jpa

2012年10月25日 20:55

相关推荐

    springboot整合mybatis整合jpa使用entityManger

    在本文中,我们将深入探讨如何在Spring Boot项目中整合MyBatis、JPA,并使用EntityManager进行数据访问。同时,我们还将介绍如何集成Redis缓存服务,以及如何对接微信支付和支付宝支付接口,以实现全面的支付功能。 ...

    jpa学习笔记 介绍了jpa中state的概念和应用

    1. New:新创建的实体,还没有identity值,尚未被EntityManager管理。 2. Managed:在持久化上下文中被管理的对象,其变化会反映到数据库。 3. Detached:脱离了持久化上下文的实例,可能已经从数据库加载过,但不再...

    hibernate_ jpa.jar

    EntityManagerFactory则用于创建EntityManager实例,它是JPA的主要接口。 三、操作实体 1. **保存(Save)**:使用EntityManager的persist()方法保存新实体,或merge()方法更新已存在的实体。 2. **删除(Delete...

    03_JPA详解_搭建JPA开发环境和全局事务介绍.zip

    5. **Repository接口**: 使用Spring Data JPA,我们可以创建一个Repository接口,该接口继承自JpaRepository或CrudRepository,提供基本的CRUD操作: ```java public interface UserRepository extends Jpa...

    jpa测试用例(很详细的介绍)

    - EntityManager是JPA的主要接口,负责管理实体对象的生命周期,包括创建、查找、更新和删除。 - Query接口提供了对SQL查询的抽象,支持JPQL(Java Persistence Query Language)和 Criteria API。 2. **单元测试...

    JPA详细教程,用于JPA入门与参考很不错

    3. **实体管理器(EntityManager)**:JPA的主要接口,负责实体的创建、查询和更新等操作。它提供了方法如`persist()`(保存)、`merge()`(合并)、`remove()`(删除)和`find()`(查找)。 4. **实体工厂...

    02_传智播客JPA详解_JPA开发环境和思想介绍

    - **创建(CREATE)**:使用`entityManager.persist(entity)`方法将新实体保存到数据库。 - **读取(RETRIEVE)**:通过`entityManager.find()`方法按ID查询,或使用`Query`对象执行更复杂的查询。 - **更新(UPDATE)*...

    JPA环境配置jar文件

    接下来,需要在类路径下创建`META-INF/persistence.xml`文件,该文件用于指定JPA实体管理和数据源的信息: ```xml &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider &lt;class&gt;...

    JPA和分布式事务简介共5页.pdf.zip

    EntityManager是JPA的核心组件,它负责管理实体的生命周期,包括创建、查询、更新和删除操作。通过`EntityManagerFactory`实例化,`EntityManager`提供了事务上下文内的持久化操作。 3. **查询语言(JPQL)** ...

    jpa-hibernate-hikaricp:Jpa,Hibernate和HikariCP项目

    JPA的核心概念包括实体(Entity)、实体管理器(EntityManager)和实体工厂(EntityManagerFactory)。实体代表数据库表,而实体管理器则是与数据库交互的主要接口,用于执行CRUD操作(创建、读取、更新和删除)。 ...

    boot-jpa:Spring Boot 整合JPA

    - 一级缓存:JPA的EntityManager内部有缓存机制,同一个事务内多次读取同一对象,不会每次都去数据库查询。 - 二级缓存:通过缓存插件如Hibernate的EHCache,可跨事务缓存数据,提高性能。 - 联合主键:当需要...

    jpa_test:jpa_test

    当事务内的操作失败时,JPA会自动回滚事务,确保数据一致性。 6. **查询语言(JPQL)** JPA提供了Java Persistence Query Language,类似于SQL,但更面向对象。例如,获取所有用户: ```java List&lt;User&gt; users =...

    jpa-study

    1. **实体创建**: 创建实体对象,设置属性值。 2. **持久化**: 使用EntityManager的`persist()`方法将实体保存到数据库。 3. **查询**: 使用JPQL或Criteria API从数据库检索数据。 4. **更新**: 修改实体对象的属性...

    传智健康写到检查项管理的增删改查的代码

    4. 在DAO层,可能会用到Spring JPA的`@Repository`注解来标识该类,使用`EntityManager`或`JpaRepository`接口的方法来执行SQL插入语句。 读取(Read)检查项可能涵盖: 1. 提供一个`getCheckItemById(Long id)`...

    Flash builder 4.5学习-通过Java持久化FB数据-Java例程

    然后,我们可以通过`EntityManager`来执行CRUD(创建、读取、更新、删除)操作。 在Flash Builder中,我们创建一个新的ActionScript项目,并在ActionScript代码中引用Java类。Flash Builder提供了与Java交互的库,...

    springboot-transaction事务

    - 使用`EntityManager`或`JpaRepository`进行的CRUD操作(创建、读取、更新、删除)都会自动在事务中执行。 9. **事务的隔离级别** - Spring支持四种事务隔离级别:READ_UNCOMMITTED(最低级别,可能存在脏读、不...

    Spring数据库访问之异常处理

    首先,Spring Data Access层的核心组件是JdbcTemplate和HibernateTemplate(或其升级版JPA的EntityManager)。这些模板类提供了事务管理和异常转换的功能,使得数据库操作更加健壮。当我们在使用它们进行数据访问时...

Global site tag (gtag.js) - Google Analytics