2016-12-04 17 views
0

JavaEE7(JAX-RS)、Hibernate OGM、MongoDB、Wildfly 10でRESTアプリケーションを構築しようとしています。THISチュートリアルを参照しようとしました。 HEREチュートリアルの完全なソースコードもあります。私は現在のバージョンのmavenファイルの依存関係の古いバージョンを置き換えました。私はWildflyに自分のアプリケーションを展開しようとすると、現時点では、私は次のエラーを取得する:Hibernate OGMを使ってMongoDBとWildflyに参加するには

21:20:25,723 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.module.service."deployment.RESTApp.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.RESTApp.war".main: WFLYSRV0179: Failed to load module: deployment.RESTApp.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:1092) 
    at org.jboss.modules.Module.link(Module.java:1448) 
    at org.jboss.modules.Module.relinkIfNecessary(Module.java:1476) 
    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:225) 
    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:68) 
    ... 5 more 

21:20:32,849 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "RESTApp.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.module.service.\"deployment.RESTApp.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.RESTApp.war\".main: WFLYSRV0179: Failed to load module: deployment.RESTApp.war:main 
    Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate:ogm"}} 

質問:私はこの問題をどのように修正することができますか?

あなたはpom.xmlファイルを見ることができます:

<?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>RESTApp</groupId> 
    <artifactId>RESTApp</artifactId> 
    <version>1.0.0-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name>RESTApp</name> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <maven.compiler.source>1.8</maven.compiler.source> 
     <maven.compiler.target>1.8</maven.compiler.target> 

     <version.org.hibernate.ogm>5.0.3.Final</version.org.hibernate.ogm> 
     <version.org.wildfly>10.1.0.Final</version.org.wildfly> 
     <version.org.jboss.arquillian>1.1.11.Final</version.org.jboss.arquillian> 
     <version.org.wildfly.arquillian>2.0.0.Final</version.org.wildfly.arquillian> 

     <jboss.home>C:\MySpace\WildFly\Wildfly_10\WILDFLY_HOME</jboss.home> 
     <ogm.module.path>C:\MySpace\Eclipse\eclipseEE\workspace\RESTApp\target\hibernate-ogm-modules</ogm.module.path> 
    </properties> 

    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.hibernate.ogm</groupId> 
       <artifactId>hibernate-ogm-core</artifactId> 
       <type>pom</type> 
       <version>${version.org.hibernate.ogm}</version> 
       <scope>import</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.jboss.arquillian</groupId> 
       <artifactId>arquillian-bom</artifactId> 
       <version>${version.org.jboss.arquillian}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <build> 
     <testResources> 
      <testResource> 
       <directory>src/test/java</directory> 
       <filtering>true</filtering> 
      </testResource> 
     </testResources> 
     <pluginManagement> 
      <plugins> 
       <!-- 
        May be used to run the application for manual testing, e.g. via curl; 
        Run "mvn pre-integration-test" once to prepare the server and modules, then the server can be 
        started via "mvn wildfly:run" 
       --> 
       <plugin> 
        <groupId>org.wildfly.plugins</groupId> 
        <artifactId>wildfly-maven-plugin</artifactId> 
        <version>1.1.0.Beta1</version> 
        <configuration> 
         <jboss-home>${jboss.home}</jboss-home> 
         <modules-path>${ogm.module.path}</modules-path> 
         <!-- 
         <javaOpts> 
          <javaOpt>-Xdebug</javaOpt> 
          <javaOpt>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000</javaOpt> 
         </javaOpts> 
          --> 
        </configuration> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-war-plugin</artifactId> 
        <version>3.0.0</version> 
        <configuration> 
         <failOnMissingWebXml>false</failOnMissingWebXml> 
        </configuration> 
       </plugin> 
      </plugins> 
     </pluginManagement> 

     <plugins> 
      <plugin> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <executions> 
        <execution> 
         <id>unpack</id> 
         <phase>pre-integration-test</phase> 
         <goals> 
          <goal>unpack</goal> 
         </goals> 
         <configuration> 
          <artifactItems> 
           <artifactItem> 
            <groupId>org.wildfly</groupId> 
            <artifactId>wildfly-dist</artifactId> 
            <version>${version.org.wildfly}</version> 
            <type>zip</type> 
            <overWrite>false</overWrite> 
            <outputDirectory>${project.build.directory}</outputDirectory> 
           </artifactItem> 
           <artifactItem> 
            <groupId>org.hibernate.ogm</groupId> 
            <artifactId>hibernate-ogm-modules-wildfly10</artifactId> 
            <version>${version.org.hibernate.ogm}</version> 
            <type>zip</type> 
            <overWrite>false</overWrite> 
            <outputDirectory>${ogm.module.path}</outputDirectory> 
           </artifactItem> 
          </artifactItems> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-failsafe-plugin</artifactId> 
       <version>2.19.1</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>integration-test</goal> 
          <goal>verify</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-api</artifactId> 
      <version>7.0</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- <artifactId>hibernate-ogm-infinispan</artifactId> --> 
     <dependency> 
      <groupId>org.hibernate.ogm</groupId>    
      <artifactId>hibernate-ogm-mongodb</artifactId>    
      <scope>provided</scope> 
     </dependency>  

     <!-- Only needed at build time for generating a mapper implementation --> 
     <dependency> 
      <groupId>org.mapstruct</groupId> 
      <artifactId>mapstruct-jdk8</artifactId> 
      <version>1.1.0.Final</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.mapstruct</groupId> 
      <artifactId>mapstruct-processor</artifactId> 
      <version>1.1.0.Final</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- Testing --> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.12</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.skyscreamer</groupId> 
      <artifactId>jsonassert</artifactId> 
      <version>1.4.0</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.arquillian.junit</groupId> 
      <artifactId>arquillian-junit-container</artifactId> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.wildfly.arquillian</groupId> 
      <artifactId>wildfly-arquillian-container-managed</artifactId> 
      <version>${version.org.wildfly.arquillian}</version> 
      <scope>test</scope> 
      <exclusions> 
       <!-- This exclusion is needed to be able to setup the project in Windows: 
        it otherwise includes transitive dependency to the JDK JConsole --> 
       <exclusion> 
        <artifactId>wildfly-patching</artifactId> 
        <groupId>org.wildfly</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.arquillian.extension</groupId> 
      <artifactId>arquillian-rest-client-api</artifactId> 
      <version>1.0.0.Alpha4</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.arquillian.extension</groupId> 
      <artifactId>arquillian-rest-client-impl-3x</artifactId> 
      <version>1.0.0.Alpha4</version> 
      <scope>test</scope> 
     </dependency> 
    </dependencies> 
</project> 

persistence.xmlファイルには、次のようになります。

<?xml version="1.0" encoding="UTF-8"?> 

<persistence version="2.1" 
    xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation=" 
     http://xmlns.jcp.org/xml/ns/persistence 
     http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> 

    <persistence-unit name="primary" transaction-type="JTA"> 

     <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider> 

     <class>com.restapp.model.Subscriber</class> 

     <properties> 

      <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform" /> 

      <property name="hibernate.ogm.datastore.provider" value="mongodb" /> 
      <property name="hibernate.ogm.datastore.database" value="db_name" /> 
      <property name="hibernate.ogm.datastore.host" value="127.0.0.1" /> 
      <property name="hibernate.ogm.datastore.port" value="27017" /> 
      <property name="hibernate.ogm.datastore.username" value="robert" /> 
      <property name="hibernate.ogm.datastore.password" value="pwd" /> 
     </properties> 

    </persistence-unit> 
</persistence> 

はたぶんjboss-deployment-structure.xmlファイルも同様に有用であろう:

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
~ Hibernate OGM, Domain model persistence for NoSQL datastores 
~ 
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later 
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. 
    --> 
<jboss-deployment-structure 
    xmlns="urn:jboss:deployment-structure:1.2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

    <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> 
</jboss-deployment-structure> 

答えて

0

最新バージョンでは、Hibernate OGMはWildFlyでモジュール名を変更したので、jboss-deployment-structure.xmlを更新する必要があります。あなたが別のバージョンの家族が必要な場合は、別のスロットを選択することができ、

<module name="org.hibernate.ogm" slot="main" services="import" /> 

または: 新しい場所があります。例えば、5.1のために次のようになります。あなたはあなたが必要なモジュールがWildFly 10モジュールフォルダ(you can download them from SourceForgeは、彼らが不足している場合)に存在していることを確認する必要があり

<module name="org.hibernate.ogm" slot="5.1" services="import" /> 

EDIT:モジュールが配置されている場所を追加しませんでした。彼らはただのモジュールフォルダ内のSourceForgeからZIPを解凍不足している場合は

$ WILDFLY_HOME /モジュール/ ORG /休止状態/ OGM/

にHibernate OGMモジュールは、下に配置する必要があります。

+0

ご協力いただきありがとうございます。まず第一に、モジュールはWildFly 10モジュールフォルダになく、あなたが言ったように 'jboss-deployment-structure.xml'ファイルに更新が必要でした。 – Robert

+0

クール!私は彼らがまだWildflyにデフォルトで含まれていないことを忘れていました。 – Davide

0

WildFly Hibernate OGMモジュールが見つかりません。 このモジュールを追加しましたか? 欠落しているモジュールやその設定をどのように追加しているのか、Wildflyが推測するのが難しくない理由は何も書いていません。

関連する問題