0

何日ものエラーの後、誰かが私を助けてくれることを願っています。Hibernate (5.1) による cassandra (3.9) を Wildfly Swarm (10.1.0) に接続したいと考えています。How to package Hibernate OGM applications for WildFly 10の指示に従い、必要なすべてのモジュールをプロジェクトに追加しました。

>>> Github のプロジェクト リポジトリ <<<

その後、必要なすべての依存関係を pom.xml に追加しました。

<packaging>war</packaging>

<dependencies>
    <!-- Java EE 7 dependency -->
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
    <!-- WildFly Swarm Fractions -->


    <dependency>
        <groupId>org.hibernate.ogm</groupId>
        <artifactId>hibernate-ogm-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate.ogm</groupId>
        <artifactId>hibernate-ogm-cassandra</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-search-orm</artifactId>
    </dependency>
</dependencies>
<build>
    <finalName>demo</finalName>
    <plugins>
        <plugin>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>wildfly-swarm-plugin</artifactId>
            <version>${version.wildfly.swarm}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>package</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

次に、jboss-deplyoment-structure.xml を追加しました。

<jboss-deployment-structure>
<deployment>
    <dependencies>
        <module name="org.hibernate.ogm" slot="5.1" services="export" />
        <module name="org.hibernate.ogm.cassandra" slot="5.1" services="export" />
    </dependencies>
</deployment>

最後に、persistence.xml を追加しました。

<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="cassandra_fhe_prd_pu" transaction-type="JTA">
    <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>

    <exclude-unlisted-classes>false</exclude-unlisted-classes>

    <properties>
        <property name="jboss.as.jpa.providerModule" value="org.hibernate:5.1"/>

        <property name="hibernate.transaction.jta.platform" value="JBossTS" />

        <property name="hibernate.ogm.datastore.provider" value="cassandra_experimental"/>


        <property name="hibernate.ogm.datastore.hosts" value="localhost"/>
        <property name="hibernate.ogm.datastore.database" value="any"/>
    </properties>
</persistence-unit>

私が読むすべての投稿は、それが私がしなければならないすべてであることを教えてくれます。しかし、アプリケーションを起動すると、次のメッセージが表示されます。

ERROR [org.jboss.as.controller.management-operation] (main) WFLYCTL0013: Operation ("add") failed - address: (("deployment" => "demo.war")) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.null"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"demo.war#cassandra_fhe_prd_pu\" is missing [jboss.naming.context.java.null]"]
}

==========================

完全な出力:

    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:                      JCA - STABLE          org.wildfly.swarm:jca:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:                  Logging - STABLE          org.wildfly.swarm:logging:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:          Bean Validation - STABLE          org.wildfly.swarm:bean-validation:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:                   JAX-RS - STABLE          org.wildfly.swarm:jaxrs:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:                      JPA - STABLE          org.wildfly.swarm:jpa:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:        CDI Configuration - STABLE          org.wildfly.swarm:cdi-config:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:                      CDI - STABLE          org.wildfly.swarm:cdi:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:              Datasources - STABLE          org.wildfly.swarm:datasources:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:             Transactions - STABLE          org.wildfly.swarm:transactions:2017.4.0
    2017-04-18 13:17:34,022 INFO  [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction:                 Undertow - STABLE          org.wildfly.swarm:undertow:2017.4.0
    2017-04-18 13:17:40,410 WARN  [org.wildfly.swarm.datasources] (main) WFSWARM1005: Not creating a default datasource due to lack of JDBC driver
    2017-04-18 13:17:40,894 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
    2017-04-18 13:17:40,957 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Swarm 2017.4.0 (WildFly Core 2.2.1.Final) starting
    2017-04-18 13:17:41,144 INFO  [org.wildfly.swarm] (MSC service thread 1-6) WFSWARM0019: Install MSC service for command line args: []
    2017-04-18 13:17:50,956 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 26) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
    2017-04-18 13:17:50,956 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 28) WFLYNAM0001: Activating Naming Subsystem
    2017-04-18 13:17:50,956 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 24) WFLYSEC0002: Activating Security Subsystem
    2017-04-18 13:17:50,971 INFO  [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=4.9.6.Final
    2017-04-18 13:17:50,971 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 18) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
    2017-04-18 13:17:51,002 INFO  [org.jboss.as.connector] (MSC service thread 1-1) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.4.Final)
    2017-04-18 13:17:51,018 INFO  [org.jboss.as.naming] (MSC service thread 1-6) WFLYNAM0003: Starting Naming Service
    2017-04-18 13:17:51,409 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0003: Undertow 1.4.11.Final starting
    2017-04-18 13:17:51,424 INFO  [org.xnio] (MSC service thread 1-8) XNIO version 3.4.3.Final
    2017-04-18 13:17:51,424 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.4.3.Final
    2017-04-18 13:17:51,487 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0012: Started server default-server.
    2017-04-18 13:17:51,518 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on [0:0:0:0:0:0:0:0]:8080
    2017-04-18 13:17:52,624 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Swarm 2017.4.0 (WildFly Core 2.2.1.Final) started in 11761ms - Started 110 of 120 services (21 services are lazy, passive or on-demand)
    2017-04-18 13:18:04,528 INFO  [org.wildfly.swarm.runtime.deployer] (main) deploying demo.war
    2017-04-18 13:18:04,544 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "demo.war" (runtime-name: "demo.war")
    2017-04-18 13:18:20,191 INFO  [org.jboss.as.jpa] (MSC service thread 1-7) WFLYJPA0002: Read persistence.xml for cassandra_fhe_prd_pu
    2017-04-18 13:18:25,686 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) WFLYSRV0018: Deployment "deployment.demo.war" is using a private module ("org.jboss.ironjacamar.jdbcadapters:main") which may be changed or removed in future versions without notice.
    2017-04-18 13:18:25,686 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) WFLYSRV0018: Deployment "deployment.demo.war" is using a private module ("org.jboss.jts:main") which may be changed or removed in future versions without notice.
    2017-04-18 13:18:26,201 ERROR [org.jboss.as.controller.management-operation] (main) WFLYCTL0013: Operation ("add") failed - address: (("deployment" => "demo.war")) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.null"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"demo.war#cassandra_fhe_prd_pu\" is missing [jboss.naming.context.java.null]"]
    }
    2017-04-18 13:18:26,201 ERROR [org.jboss.as.server] (main) WFLYSRV0021: Deploy of deployment "demo.war" was rolled back with the following failure message:
    {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.null"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"demo.war#cassandra_fhe_prd_pu\" is missing [jboss.naming.context.java.null]"]
    }
    2017-04-18 13:18:27,045 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0028: Stopped deployment demo.war (runtime-name: demo.war) in 838ms
    2017-04-18 13:18:27,045 INFO  [org.jboss.as.controller] (main) WFLYCTL0183: Service status report
    WFLYCTL0184:    New missing/unsatisfied dependencies:
    service jboss.naming.context.java.null (missing) dependents: [service jboss.persistenceunit."demo.war#cassandra_fhe_prd_pu"]
    service jboss.persistenceunit."demo.war#cassandra_fhe_prd_pu" (missing) dependents: [service jboss.deployment.unit."demo.war".POST_MODULE]

    2017-04-18 13:18:27,045 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0008: Undertow HTTP listener default suspending
    2017-04-18 13:18:27,045 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0007: Undertow HTTP listener default stopped, was bound to [0:0:0:0:0:0:0:0]:8080
    2017-04-18 13:18:27,045 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0004: Undertow 1.4.11.Final stopping
    2017-04-18 13:18:27,061 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0050: WildFly Swarm 2017.4.0 (WildFly Core 2.2.1.Final) stopped in 7ms
    2017-04-18 13:18:27,076 INFO  [org.jboss.weld.Bootstrap] (main) WELD-ENV-002001: Weld SE container internal shut down
    2017-04-18 13:18:27,076 ERROR [stderr] (main) java.lang.reflect.InvocationTargetException
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at java.lang.reflect.Method.invoke(Method.java:498)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.bootstrap.Main.run(Main.java:46)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.bootstrap.Main.main(Main.java:37)
    2017-04-18 13:18:27,076 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: org.wildfly.swarm.container.DeploymentException: WFSWARM0004: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.null"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"demo.war#cassandra_fhe_prd_pu\" is missing [jboss.naming.context.java.null]"]}
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:278)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:94)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.container.runtime.RuntimeDeployer$Proxy$_$$_WeldClientProxy.deploy(Unknown Source)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.Swarm.deploy(Swarm.java:443)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.Swarm.main(Swarm.java:611)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    ... 7 more
    2017-04-18 13:18:27,076 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0004: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.null"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"demo.war#cassandra_fhe_prd_pu\" is missing [jboss.naming.context.java.null]"]}
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:273)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    ... 11 more
    2017-04-18 13:18:27,076 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at java.lang.reflect.Method.invoke(Method.java:498)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.bootstrap.Main.run(Main.java:46)
    2017-04-18 13:18:27,076 ERROR [stderr] (main)    at org.wildfly.swarm.bootstrap.Main.main(Main.java:37)
    2017-04-18 13:18:27,076 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: org.wildfly.swarm.container.DeploymentException: WFSWARM0004: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.null"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"demo.war#cassandra_fhe_prd_pu\" is missing [jboss.naming.context.java.null]"]}
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:278)
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:94)
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    at org.wildfly.swarm.container.runtime.RuntimeDeployer$Proxy$_$$_WeldClientProxy.deploy(Unknown Source)
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    at org.wildfly.swarm.Swarm.deploy(Swarm.java:443)
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    at org.wildfly.swarm.Swarm.main(Swarm.java:611)
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    ... 7 more
    2017-04-18 13:18:27,092 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0004: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.null"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"demo.war#cassandra_fhe_prd_pu\" is missing [jboss.naming.context.java.null]"]}
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    at    org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:273)
    2017-04-18 13:18:27,092 ERROR [stderr] (main)    ... 11 more

    Process finished with exit code 1

誰が私が間違っているのか教えてもらえますか?

編集

コメントの後、次のように Datastax JDBC ラッパーを追加しました。

project-stages.yml

swarm:
  datasources:
    data-sources:
      CassandraDS:
        driver-name: cassandra
        connection-url: jdbc:cassandra://localhost:9160/system?version=3.9
    jdbc-drivers:
      cassandra:
        driver-class-name: org.apache.cassandra2.cql.jdbc.CassandraDriver
        xa-datasource-name: com.github.adejanovski.cassandra.jdbc.CassandraDataSource
        driver-module-name: org.github.adejanovski.cassandra

モジュール.xml

<module xmlns="urn:jboss:module:1.3" name="org.github.adejanovski.cassandra">
    <resources>
        <resource-root path="cassandra-jdbc-wrapper-3.1.0.jar"/>
        <resource-root path="slf4j-jdk14-1.7.24.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="sun.jdk" export="true" >
            <imports>
                <include path="sun/misc/Unsafe" />
            </imports>
        </module>
    </dependencies>
</module>

jboss-deployment-structure.xml

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.hibernate.ogm" slot="5.1" services="export" />
            <module name="org.hibernate.ogm.cassandra" slot="5.1" services="export" />
            <module name="org.github.adejanovski.cassandra" slot="main" services="export" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

およびpersistence.xml

<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="cassandra_fhe_prd_pu" transaction-type="JTA">
        <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
        <jta-data-source>java:/CassandraDS</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="jboss.as.jpa.providerModule" value="org.hibernate:5.1"/>

            <property name="hibernate.transaction.jta.platform" value="JBossTS"/>

            <property name="hibernate.ogm.datastore.provider" value="cassandra_experimental"/>

            <property name="hibernate.ogm.datastore.hosts" value="localhost"/>
            <property name="hibernate.ogm.datastore.database" value="fhe"/>
        </properties>
    </persistence-unit>
</persistence>

現在、エラーメッセージは次のように表示されています。

WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "CassandraDS")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.cassandra"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "org.wildfly.data-source.CassandraDS is missing [jboss.jdbc-driver.cassandra]",
        "jboss.driver-demander.java:jboss/datasources/CassandraDS is missing [jboss.jdbc-driver.cassandra]"
    ]
}
4

1 に答える 1