我正在寻找帮助使用Hibernate OGM和MongoDB配置Wildfly 10 ...我有以下错误:
11:13:17,164 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.module.service."deployment.brx-plataforma.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.brx-plataforma.war".main: WFLYSRV0179: Failed to load module: deployment.brx-plataforma.war:main
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate:ogm
at org.jboss.modules.Module.addPaths(Module.java:1093)
at org.jboss.modules.Module.link(Module.java:1449)
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1477)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:225)
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:68)
... 5 more
11:13:17,192 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "brx-plataforma.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.module.service.\"deployment.brx-plataforma.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.brx-plataforma.war\".main: WFLYSRV0179: Failed to load module: deployment.brx-plataforma.war:main
Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate:ogm"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.module.service.\"deployment.brx-plataforma.war\".main"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
mongoDB没有Hibernate OGM模块,实际上没有OGM模块
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.brx</groupId>
<artifactId>brx-plataforma</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>brx-plataforma</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.jboss.bom>10.0.0.Final</version.jboss.bom>
</properties>
<dependencyManagement>
<dependencies>
<!-- Configuracao tools jboss -->
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-javaee7-with-tools</artifactId>
<version>${version.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Hibernate OGM - MongoDB -->
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-bom</artifactId>
<version>5.0.4.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- CDI -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<!--Jboss annotation -->
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!--JAX-RS -->
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
<scope>provided</scope>
</dependency>
<!--JPA -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<scope>provided</scope>
</dependency>
<!--EJB -->
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!--JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Hibernate OGM - MongoDB -->
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
</dependency>
</dependencies>
<build>
<!-- Maven - Java 8 -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
在pom.xml中描述了Hibernate OGM和mongoDB的依赖关系。
以下是jboss-deployment-structure.xml的配置:
<deployment>
<dependencies>
<module name="org.hibernate" slot="ogm" services="import" />
<module name="org.hibernate.ogm.mongodb" services="import" />
<module name="org.hibernate.search.orm" services="import" />
</dependencies>
</deployment>
以下是persistence.xml的配置
<?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="brx-plataforma" transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<!-- Cadastro de usuario -->
<class>br.com.brx.plataforma.cadastro.usuario.entity.Pessoa</class>
<class>br.com.brx.plataforma.cadastro.usuario.entity.PessoaFisica</class>
<class>br.com.brx.plataforma.cadastro.usuario.entity.PessoaJuridica</class>
<class>br.com.brx.plataforma.cadastro.usuario.entity.Usuario</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="brxdb"/>
<property name="hibernate.ogm.datastore.host" value="localhost"/>
<property name="hibernate.ogm.datastore.port" value="27017"/>
</properties>
</persistence-unit>
我正在使用wildfly-10.1.0.Final,里面有模块文件夹...我想知道如何继续...是否有必要将一些模块放在正确的服务器中?但是我试过了,我不知道文件夹结构是否出错。
感谢您的帮助
答案 0 :(得分:0)
在你的jboss-deployment-structure.xml中替换:
<module name="org.hibernate" slot="ogm" services="import" />
与
<module name="org.hibernate.ogm" slot="main" services="import" />
如果您在WILDFLY_HOME/modules/org/hibernate/ogm/main
下有ogm模块,这应该有效。如果您没有,可以download them from the Maven Central repository。