Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 修复OSGi环境中的OpenJPA实体增强_Spring_Osgi Bundle_Apache Servicemix_Openjpa Maven Plugin - Fatal编程技术网

Spring 修复OSGi环境中的OpenJPA实体增强

Spring 修复OSGi环境中的OpenJPA实体增强,spring,osgi-bundle,apache-servicemix,openjpa-maven-plugin,Spring,Osgi Bundle,Apache Servicemix,Openjpa Maven Plugin,我正试图在OSGi容器(即ApacheServiceMix)中部署我的包。在其中,我有我的OpenJPA实体。我使用的是OpenJPA版本2.3.0。当我尝试使用EntityManager通过Springbean访问这些实体时,出现以下错误: 1 model WARN [SpringOsgiExtenderThread-4] openjpa.Runtime - An error occurred while registering a ClassTransformer with Pers

我正试图在OSGi容器(即ApacheServiceMix)中部署我的包。在其中,我有我的OpenJPA实体。我使用的是OpenJPA版本2.3.0。当我尝试使用
EntityManager
通过Springbean访问这些实体时,出现以下错误:

1  model  WARN   [SpringOsgiExtenderThread-4] openjpa.Runtime - An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'model', root URL [bundle://220.0:1]. The error is logged along with this warning. Load-time class transformation will not be available.java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy34.addTransformer(Unknown Source)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:169)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.reflect.InvocationTargetException
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:606)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager$Jpa2PersistenceUnitInfoDecorator.invoke(DefaultPersistenceUnitManager.java:617)
... 21 more
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:109)
... 26 more
请记住,我的持久化单元称为“模型”,以便更清晰地概述。有人能帮我用maven增强我的实体吗

下面是我的代码片段表单my pom.xml:

<plugin>
    <groupId>org.apache.openjpa</groupId>
    <artifactId>openjpa-maven-plugin</artifactId>
    <version>2.3.0</version>
    <executions>
        <execution>
            <id>JPA Enhance</id>
            <phase>process-classes</phase>
            <goals>
                <goal>enhance</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <includes>**/entity/*.class</includes>
        <excludes>**/entity/XML*.class</excludes>
        <addDefaultConstructor>true</addDefaultConstructor>
        <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
    </configuration>
</plugin>

org.apache.openjpa
openjpa maven插件
2.3.0
JPA增强
进程类
增强
**/实体/*.class
**/实体/XML*.class
真的
真的
还有谁能告诉我,在includes/excludes标签中,我应该放什么来代替实体?
有了这个,上面提供的错误就发生了。我认为我已接近解决方案,但无法使其正常工作。

在不知道persistence.xml的外观的情况下,我猜您缺少以下内容:

<property name="openjpa.RuntimeUnenhancedClasses" value="supported" />


如果不是这样的话,我会去寻找为什么春天似乎有一个问题

请不要建议设置此属性,因为它有缺陷,将导致更多问题。