休眠 OGM mongodb 示例

Hibernate OGM mongodb example

我是 java ee 的新手,我正在搜索一些使用 Mongodb 的休眠 OGM 示例。我发现了这个:https://github.com/fmarchioni/mastertheboss/tree/master/hibernateogm-mongo 但我正在努力 运行 它。 这些是我完成的步骤:

尝试 运行 项目时出现此错误

13:32:49,916 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."hibernateogm-mongo.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."hibernateogm-mongo.war".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "hibernateogm-mongo.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:151)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0027: Persistence provider module load error org.hibernate.ogm (class org.hibernate.ogm.jpa.HibernateOgmPersistence)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:991)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:266)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleWarDeployment(PersistenceUnitServiceHandler.java:206)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:134)
    at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:144)
    ... 8 more
Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate.ogm
    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:294)
    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:280)
    at org.jboss.as.jpa.persistenceprovider.PersistenceProviderLoader.loadProviderModuleByName(PersistenceProviderLoader.java:65)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:987)
    ... 13 more

13:32:50,978 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-3) ISPN000128: Infinispan version: Infinispan 'Estrella Galicia' 9.3.1.Final
13:32:51,380 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 72) WFLYCLINF0002: Started client-mappings cache from ejb container
13:32:51,602 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 72) WFLYUT0021: Registered web context: '/wildflyDynamicProject' for server 'default-server'
13:32:51,612 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "hibernateogm-mongo.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"hibernateogm-mongo.war\".FIRST_MODULE_USE" => "WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"hibernateogm-mongo.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0027: Persistence provider module load error org.hibernate.ogm (class org.hibernate.ogm.jpa.HibernateOgmPersistence)
    Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate.ogm"}}

可以看到实际错误是org.jboss.modules.ModuleNotFoundException: org.hibernate.ogm

现在问题:

那个例子很老了,我已经创建了一个最新的例子,我打算将它包含在我个人存储库的项目中。

这是 link:https://github.com/DavideD/hibernate-demos/tree/master/hibernate-ogm/nosql-with-hibernate-ogm-101/hibernate-ogm-demo-nosql-with-hibernate-ogm-101-part-3

该项目展示了如何设置 Maven 构建,使用配置插件为 WildFly 13 准备适当的模块。它还显示了 persistence.xml 和 jboss 部署描述符的基本配置。

要记住的一件事是,您需要使用属性 -Dee8.preview.mode=true 启动服务器,如您在 arquillian.xml

中所见

希望对您有所帮助