Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.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
Mongodb 如何让hibernate ogm在jboss eap 6.2上工作?_Mongodb_Jpa_Hibernate Ogm - Fatal编程技术网

Mongodb 如何让hibernate ogm在jboss eap 6.2上工作?

Mongodb 如何让hibernate ogm在jboss eap 6.2上工作?,mongodb,jpa,hibernate-ogm,Mongodb,Jpa,Hibernate Ogm,我正试图让monogodb提供商在jboss eap 6.2上运行hibernate ogm 我已经配置了persistence.xml <?xml version="1.0"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schema

我正试图让monogodb提供商在jboss eap 6.2上运行hibernate ogm

我已经配置了persistence.xml

<?xml version="1.0"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">

    <persistence-unit name="monitor" transaction-type="JTA">
        <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
        <!--<jta-data-source>java:/jdbc/monitorservice/monitorDs</jta-data-source>-->
        <!--<jta-data-source>java:/DefaultDS</jta-data-source>-->
        <properties>
            <property name="hibernate.transaction.jta.platform"
                      value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />

            <property name="hibernate.ogm.datastore.provider" value="mongodb" />
            <property name="hibernate.ogm.datastore.database" value="db"/>
            <property name="hibernate.ogm.datastore.host" value="server"/>
            <property name="hibernate.ogm.datastore.port" value="port"/>
            <property name="hibernate.ogm.datastore.username" value="user"/>
            <property name="hibernate.ogm.datastore.password" value="pass"/>

        </properties>
    </persistence-unit>
</persistence>
但在执行代码时,我得到以下异常:

Caused by: java.lang.IllegalArgumentException: Can not set javax.persistence.EntityManager field com.example.ProcessDao.entityManager to org.hibernate.ogm.hibernatecore.impl.OgmSessionFactoryImpl
        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) [rt.jar:1.7.0_71]
        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) [rt.jar:1.7.0_71]
        at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) [rt.jar:1.7.0_71]
        at java.lang.reflect.Field.set(Field.java:741) [rt.jar:1.7.0_71]
        at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:114) [jboss-as-ee-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:272) [jboss-as-ejb3-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        ... 165 more

你知道我能做些什么来让它工作吗?

Hibernate OGM需要JBoss EAP附带的一些库的更新版本(例如,它只使用Hibernate ORM最新版本附带的功能)

以前有一个实验性的ZIP文件,您可以将其解压缩到安装的顶部,以添加Hibernate OGM和所有必需的模块。不幸的是,这个ZIP文件最近没有更新,因此不是Hibernate OGM 4.1.0.Final发行版的一部分。我们计划更新ZIP文件,但还没有


因此,目前,您可以在Wildfly 8上使用Hibernate OGM。或者,如果您觉得很冒险,您可以构建模块ZIP并研究所需的更改(如果由此产生拉取请求,我们将非常乐意将其集成)。

我在hibernate ogm论坛上也提出了同样的问题:
Caused by: java.lang.IllegalArgumentException: Can not set javax.persistence.EntityManager field com.example.ProcessDao.entityManager to org.hibernate.ogm.hibernatecore.impl.OgmSessionFactoryImpl
        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) [rt.jar:1.7.0_71]
        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) [rt.jar:1.7.0_71]
        at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) [rt.jar:1.7.0_71]
        at java.lang.reflect.Field.set(Field.java:741) [rt.jar:1.7.0_71]
        at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:114) [jboss-as-ee-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:272) [jboss-as-ejb3-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
        ... 165 more