在使用Mongodb的Hibernate OGM持久性单元时,在Wildfly 10.1.0上部署应用程序时出现错误。在尝试了几个模块和配置组合之后,我按照this post的答案。
我相信我的模块组织正确。 jboss-deployment-structure看起来像这样:
No connection could be made because the target machine actively refused it 127.0.0.1:5672
我的持久性单元如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<module name="org.hibernate.ogm.mongodb" services="import" />
<module name="org.hibernate.search.orm" services="import" />
<module name="org.hibernate.search.engine" slot="5.6" services="import" />
</dependencies>
</deployment>
</jboss-deployment-structure>
我收到错误消息,表明缺少Hibernate 5.1模块:
<?xml version="1.0" encoding="UTF-8"?>
<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="ogm-mongodb" transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<class>org.secomm.authenticator.persistence.ServerVault</class>
<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="mydatabase"/>
<property name="hibernate.ogm.datastore.host" value="myhost"/>
<property name="hibernate.ogm.datastore.username" value="***" />
<property name="hibernate.ogm.datastore.password" value="***"/>
</properties>
</persistence-unit>
</persistence>
似乎不是一个单一,连贯的hibernate 5.1模块包。如果我开始尝试手动添加Hibernate模块,它会导致搜索引擎依赖项的漏洞导致我错误地认为SPI积分器类不是子类型。
对此有任何帮助表示赞赏。
答案 0 :(得分:1)
这是您必须下载并添加到WildFly的模块:
<groupId>org.hibernate</groupId>
<artifactId>hibernate-orm-modules</artifactId>
<version>5.1.10.Final</version>
<classifier>wildfly-10-dist</classifier>
在$WILDFLY_HOME/modules
中提取它,它应该有效。
如果您不使用maven,可以从JBoss Nexus存储库下载:https://repository.jboss.org/nexus/content/groups/public/org/hibernate/hibernate-orm-modules/5.1.10.Final/hibernate-orm-modules-5.1.10.Final-wildfly-10-dist.zip