无法将Hibernate OGM(MongoDB)应用程序部署到Wildfly

时间:2015-07-18 11:02:48

标签: mongodb hibernate wildfly hibernate-ogm

我为学习目的开发了一个简单的应用程序。我使用Wildfly 8(并转移到9)作为我的应用程序服务器,Hibernate作为JPA提供程序,MySQL作为DB。部署工作顺利,没有任何问题 因为我想学习如何使用MongoDB和Hibernate OGM,所以我阅读了几个教程并完全按照指示完成:

  1. download并解压缩到模块文件夹
  2. 更改persistence.xml以使用hibernate.ogm属性
  3. 更改实体' ids使用String并生成uuid' s
  4. 添加jboss-deployment-structure.xml(到顶级EAR项目):

    <jboss-deployment-structure>
        <deployment>
            <dependencies>
                <module name="org.hibernate" slot="ogm" services="export" />
                <module name="org.hibernate.ogm.mongodb" slot="main" services="export" />
            </dependencies>
        </deployment>
    </jboss-deployment-structure>
    
  5. 从pom .sml

  6. 中删除了所有MySQL部分

    但部署仍无效。导致异常:

     20:01:38,948 INFO  [org.jboss.as.repository] (management-handler-thread - 12) WFLYDR0001: Content added at location C:\Royi\DevTools\JBoss\wildfly-9.0.0.Final\standalone\data\content\6f\6eb320cf29bae10807b7c212dc37537f35547f\content
    20:01:38,952 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "MyProject-ear.ear" (runtime-name: "MyProject-ear.ear")
    20:01:38,981 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0207: Starting subdeployment (runtime-name: "MyProject-ejb.jar")
    20:01:38,981 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0207: Starting subdeployment (runtime-name: "MyProject-war.war")
    20:01:38,989 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) WFLYJPA0002: Read persistence.xml for MyProjectPU
    20:01:39,001 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 64) WFLYJPA0003: Starting Persistence Unit Service 'MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU'
    20:01:39,001 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 64) HHH000204: Processing PersistenceUnitInfo [
        name: MyProjectPU
        ...]
    20:01:39,011 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 64) MSC000001: Failed to start service jboss.persistenceunit."MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU": org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.datastore.spi.DatastoreProvider]
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
        at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:665)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
        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)
        at org.jboss.threads.JBossThread.run(JBossThread.java:320)
    Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.datastore.spi.DatastoreProvider]
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
        at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:50)
        at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:34)
        at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
        at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator$OgmDialectFactory.<init>(OgmDialectFactoryInitiator.java:44)
        at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:31)
        at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:25)
        at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
        at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:95)
        at org.hibernate.ogm.service.impl.OgmJdbcServicesInitiator$OgmJdbcServicesImpl.configure(OgmJdbcServicesInitiator.java:50)
        at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
        at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
        at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152)
        at org.hibernate.ogm.jpa.HibernateOgmPersistence.createContainerEntityManagerFactory(HibernateOgmPersistence.java:105)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
        ... 7 more
    Caused by: org.hibernate.HibernateException: OGM000044: Cannot load class org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider specified via configuration property 'hibernate.ogm.datastore.provider'
        at org.hibernate.ogm.util.configurationreader.impl.DefaultClassPropertyReaderContext.getClassFromString(DefaultClassPropertyReaderContext.java:130)
        at org.hibernate.ogm.util.configurationreader.impl.DefaultClassPropertyReaderContext.getTypedValue(DefaultClassPropertyReaderContext.java:98)
        at org.hibernate.ogm.util.configurationreader.impl.PropertyReaderContextBase.getValue(PropertyReaderContextBase.java:90)
        at org.hibernate.ogm.util.configurationreader.impl.DefaultClassPropertyReaderContext.getValue(DefaultClassPropertyReaderContext.java:28)
        at org.hibernate.ogm.datastore.impl.DatastoreProviderInitiator.initiateService(DatastoreProviderInitiator.java:48)
        at org.hibernate.ogm.datastore.impl.DatastoreProviderInitiator.initiateService(DatastoreProviderInitiator.java:28)
        at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
        ... 38 more
    Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider]
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:245)
        at org.hibernate.ogm.util.configurationreader.impl.DefaultClassPropertyReaderContext.getClassFromString(DefaultClassPropertyReaderContext.java:127)
        ... 45 more
    Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:230)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:344)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:242)
        ... 46 more
    
    20:01:39,013 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 12) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "MyProject-ear.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\": org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.datastore.spi.DatastoreProvider]
        Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.datastore.spi.DatastoreProvider]
        Caused by: org.hibernate.HibernateException: OGM000044: Cannot load class org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider specified via configuration property 'hibernate.ogm.datastore.provider'
        Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider]
        Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider"}}
    20:01:39,014 ERROR [org.jboss.as.server] (management-handler-thread - 12) WFLYSRV0021: Deploy of deployment "MyProject-ear.ear" was rolled back with the following failure message: 
    {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\": org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.datastore.spi.DatastoreProvider]
        Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.datastore.spi.DatastoreProvider]
        Caused by: org.hibernate.HibernateException: OGM000044: Cannot load class org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider specified via configuration property 'hibernate.ogm.datastore.provider'
        Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider]
        Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider"}}
    

    修改
    我有一些进步 出于某种原因,maven不喜欢<scope>provided</scope>依赖项上的hibernate-ogm-mongodb。删除它后,新的数据库已创建,但现在抛出了另一个异常:

    20:06:16,697 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0027: Starting deployment of "MyProject-ear.ear" (runtime-name: "MyProject-ear.ear")
    20:06:18,043 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0207: Starting subdeployment (runtime-name: "MyProject-war.war")
    20:06:18,043 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0207: Starting subdeployment (runtime-name: "MyProject-ejb.jar")
    20:06:18,053 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) WFLYJPA0002: Read persistence.xml for MyProjectPU
    20:06:18,084 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 65) WFLYJPA0003: Starting Persistence Unit Service 'MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU'
    20:06:18,084 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 65) HHH000204: Processing PersistenceUnitInfo [
        name: MyProjectPU
        ...]
    20:06:18,092 INFO  [org.hibernate.ogm.datastore.impl.DatastoreProviderInitiator] (ServerService Thread Pool -- 65) OGM000016: NoSQL Datastore provider: org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider
    20:06:18,093 INFO  [org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider] (ServerService Thread Pool -- 65) OGM001201: Connecting to MongoDB at localhost:27017,  with a timeout set at 5000 millisecond(s)
    20:06:18,094 INFO  [org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider] (ServerService Thread Pool -- 65) OGM001207: Connecting to Mongo database named [MyProjectDB].
    20:06:18,096 INFO  [org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider] (ServerService Thread Pool -- 65) OGM001206: Mongo database named [MyProjectDB] is not defined. Creating it!
    20:06:18,097 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 65) MSC000001: Failed to start service jboss.persistenceunit."MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU": org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.dialect.spi.GridDialect]
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
        at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:665)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
        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)
        at org.jboss.threads.JBossThread.run(JBossThread.java:320)
    Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.dialect.spi.GridDialect]
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
        at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator$OgmDialectFactory.<init>(OgmDialectFactoryInitiator.java:44)
        at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:31)
        at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:25)
        at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
        at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:95)
        at org.hibernate.ogm.service.impl.OgmJdbcServicesInitiator$OgmJdbcServicesImpl.configure(OgmJdbcServicesInitiator.java:50)
        at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
        at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
        at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152)
        at org.hibernate.ogm.jpa.HibernateOgmPersistence.createContainerEntityManagerFactory(HibernateOgmPersistence.java:105)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
        ... 7 more
    Caused by: org.hibernate.HibernateException: OGM000011: Cannot instantiate GridDialect class [org.hibernate.ogm.datastore.mongodb.MongoDBDialect]
        at org.hibernate.ogm.dialect.impl.GridDialectInitiator$GridDialectInstantiator.newInstance(GridDialectInitiator.java:115)
        at org.hibernate.ogm.dialect.impl.GridDialectInitiator$GridDialectInstantiator.newInstance(GridDialectInitiator.java:64)
        at org.hibernate.ogm.util.configurationreader.impl.DefaultClassPropertyReaderContext.getDefaultValue(DefaultClassPropertyReaderContext.java:116)
        at org.hibernate.ogm.util.configurationreader.impl.DefaultClassPropertyReaderContext.getTypedValue(DefaultClassPropertyReaderContext.java:86)
        at org.hibernate.ogm.util.configurationreader.impl.PropertyReaderContextBase.getValue(PropertyReaderContextBase.java:90)
        at org.hibernate.ogm.util.configurationreader.impl.DefaultClassPropertyReaderContext.getValue(DefaultClassPropertyReaderContext.java:28)
        at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:61)
        at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:34)
        at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
        ... 32 more
    Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
        at org.hibernate.ogm.dialect.impl.GridDialectInitiator$GridDialectInstantiator.newInstance(GridDialectInitiator.java:93)
        ... 41 more
    
    20:06:18,098 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 16) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "MyProject-ear.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\": org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.dialect.spi.GridDialect]
        Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.dialect.spi.GridDialect]
        Caused by: org.hibernate.HibernateException: OGM000011: Cannot instantiate GridDialect class [org.hibernate.ogm.datastore.mongodb.MongoDBDialect]
        Caused by: java.lang.IllegalArgumentException: argument type mismatch"}}
    20:06:18,099 ERROR [org.jboss.as.server] (management-handler-thread - 16) WFLYSRV0021: Deploy of deployment "MyProject-ear.ear" was rolled back with the following failure message: 
    {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"MyProject-ear.ear/MyProject-ejb.jar#MyProjectPU\": org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.dialect.spi.GridDialect]
        Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ogm.dialect.spi.GridDialect]
        Caused by: org.hibernate.HibernateException: OGM000011: Cannot instantiate GridDialect class [org.hibernate.ogm.datastore.mongodb.MongoDBDialect]
        Caused by: java.lang.IllegalArgumentException: argument type mismatch"}}
    

2 个答案:

答案 0 :(得分:1)

我有问题,我解决了它在pom中添加模块依赖项。

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Dependencies>org.hibernate.ogm:5.0 services, org.hibernate.ogm.mongodb:5.0 services</Dependencies> 
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

工件可能是maven-jar-plugin,maven-war-plugin或maven-ear-plugin取决于你的项目。

答案 1 :(得分:0)

您必须为可部署的Hibernate OGM核心和MongoDB后端模块声明依赖项。查看具有全部the details

的Hibernate OGM参考指南