Nan Xiang
Nan Xiang

Reputation: 11

Wildfly cannot find cassandra jdbc driver

I have problem connect my cassandraDB to wildfly. I am using Cassandra 3.0.9 and wildfly 10.1.0.Final.

When I start the wildfly server, it will give me an error like this:

ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) 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" => ["jboss.driver-demander.java:jboss/datasources/cassandraDS is missing [jboss.jdbc-driver.cassandra]","org.wildfly.data-source.cassandraDS is missing [jboss.jdbc-driver.cassandra]"]}

Here is my standalone.xml to add cassandra datasource:

...
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
        <datasources>
            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                <driver>h2</driver>
                <security>
                    <user-name>sa</user-name>
                    <password>sa</password>
                </security>
            </datasource>
            <datasource jta="false" jndi-name="java:jboss/datasources/cassandraDS" pool-name="cassandraDS" enabled="true" use-java-context="true" use-ccm="false">
                <connection-url>jdbc:cassandra://localhost:9042</connection-url>
                <driver>cassandra</driver>
            </datasource>
            <drivers>
                <driver name="h2" module="com.h2database.h2">
                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                </driver>
                <driver name="cassandra" module="org.wildfly.extension.cassandra">
                    <datasource-class>org.apache.cassandra.cql.jdbc.CassandraDataSource</datasource-class>
                </driver>
            </drivers>
        </datasources>
</subsystem>
...

And here is my module.xml for my cassandra jdbc driver:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.wildfly.extension.cassandra">
<properties>
  <property name="jboss.api" value="private"/>
</properties>
<resources>
  <!-- the subsystem itself -->
  <resource-root path="wildfly-cassandra.jar"/>

  <!-- cassandra libs -->
  <resource-root path="cassandra-all-2.1.5.jar"/>
  <resource-root path="cassandra-thrift-2.1.5.jar"/>

  <!-- cassandra dependencies -->
  <resource-root path="ST4-4.0.8.jar"/>
  <resource-root path="antlr-3.5.2.jar"/>
  <resource-root path="antlr-runtime-3.5.2.jar"/>
  <resource-root path="commons-cli-1.1.jar"/>
  <resource-root path="commons-codec-1.2.jar"/>
  <resource-root path="commons-lang3-3.1.jar"/>
  <resource-root path="commons-math3-3.2.jar"/>
  <resource-root path="compress-lzf-0.8.4.jar"/>
  <resource-root path="concurrentlinkedhashmap-lru-1.4.jar"/>
  <resource-root path="disruptor-3.0.1.jar"/>
  <resource-root path="fastutil-6.5.7.jar"/>
  <resource-root path="guava-16.0.jar"/>
  <resource-root path="hibernate-validator-4.3.0.Final.jar"/>
  <resource-root path="high-scale-lib-1.0.6.jar"/>
  <resource-root path="httpclient-4.2.5.jar"/>
  <resource-root path="httpcore-4.2.4.jar"/>
  <resource-root path="jackson-core-asl-1.9.2.jar"/>
  <resource-root path="jackson-mapper-asl-1.9.2.jar"/>
  <resource-root path="jamm-0.3.0.jar"/>
  <resource-root path="jbcrypt-0.3m.jar"/>
  <resource-root path="jline-1.0.jar"/>
  <resource-root path="jna-4.0.0.jar"/>
  <resource-root path="json-simple-1.1.jar"/>
  <resource-root path="libthrift-0.9.2.jar"/>
  <resource-root path="lz4-1.2.0.jar"/>
  <resource-root path="metrics-core-2.2.0.jar"/>
  <resource-root path="netty-all-4.0.23.Final.jar"/>
  <resource-root path="reporter-config-2.1.0.jar"/>
  <resource-root path="snakeyaml-1.13.jar"/>
  <resource-root path="snappy-java-1.0.5.jar"/>
  <resource-root path="stream-2.5.2.jar"/>
  <resource-root path="super-csv-2.1.0.jar"/>
  <resource-root path="thrift-server-0.3.7.jar"/>
  <resource-root path="validation-api-1.0.0.GA.jar"/>

  <!-- the configuration overlays -->
  <resource-root path="conf"/>
</resources>

<dependencies>
  <module name="org.slf4j"/>
  <module name="javax.api"/>
  <module name="org.jboss.staxmapper"/>
  <module name="org.jboss.as.controller"/>
  <module name="org.jboss.as.server"/>
  <module name="org.jboss.modules"/>
  <module name="org.jboss.msc"/>
  <module name="org.jboss.logging"/>
  <module name="org.jboss.vfs"/>
  <module name="sun.jdk"/>
  <!-- access to sun.misc.Unsafe -->
</dependencies>

I have my cassandra jdbc driver configured according to this blog: http://johnsanda.blogspot.com/2012/10/configuring-cassandra-jdbc-with-jboss.html

And the jdbc driver dir I use is downloaded from here:

https://code.google.com/archive/a/apache-extras.org/p/cassandra-jdbc

I am pretty sure I have the directories and files are in the right places. I have the module.xml in

$WILDFLY_HOME/modules/system/layers/base/org/wildfly/extension/cassandra/main

along with its dependencies.

And I have the datasource class in

$WILDFLY_HOME/modules/system/layers/base/org/apache/cassandra/cql/jdbc

I can see the datasource is added through my wildfly admin page. But when I try to test connection, it failed. But the exampleDS provided by wildfly worked perfect.

I don't know what is going on. Is there because of some version compatibility problems? But I didn't see cassandra providing their official jdbc driver on their homepage.

Someone please help me!

Upvotes: 0

Views: 922

Answers (1)

Nan Xiang
Nan Xiang

Reputation: 11

Actually, someone just helped me out. Here is the link of wildfly forum about solving this problem: https://developer.jboss.org/thread/274131

Upvotes: 1

Related Questions