4 Replies Latest reply on Jul 19, 2014 5:46 AM by emmanuel.lesne

    Wildfly 8.1 and mysql

    emmanuel.lesne Newbie

      Hi,

       

      I would to create a Datasource to my mysql DB.

      I add a module "com.mysql" into modules\system\layers\base\com\mysql\main

       

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

              <module xmlns="urn:jboss:module:1.3" name="com.mysql">

                  <resources>

                      <resource-root path="mysql-connector-java-5.1.31-bin.jar"/>

                  </resources>

                  <dependencies>

                      <module name="javax.api"/>

                      <module name="javax.transaction.api"/>

                  </dependencies>

              </module>

       

      My webapplication (jaspereport server) have a datasource file:

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

      <datasources>

          <datasource jta="false" jndi-name="java:/jdbc/jasperserver" pool-name="jasperserver" enabled="true" use-ccm="false">

              <connection-url>jdbc:mysql://localhost:3306/jasperserver?useUnicode=true&amp;characterEncoding=UTF-8&amp;autoReconnect=true&amp;autoReconnectForPools=true</connection-url>

              <driver>mysql</driver>

              <security>

                  <user-name>root</user-name>

                  <password>root</password>

              </security>

              <pool>

                  <min-pool-size>5</min-pool-size>

                  <max-pool-size>50</max-pool-size>

                  <prefill>true</prefill>

        </pool>

        <validation>

                  <validate-on-match>true</validate-on-match>

                  <background-validation>false</background-validation>

                  <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker" />

                      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter" />

              </validation>

              <statement>

                  <share-prepared-statements>false</share-prepared-statements>

              </statement>

          </datasource>

      </datasources>

       

      When I try to start my server, i have this trace:

      00:32:01,126 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010417: Started Driver service with driver-name = h2

      00:32:01,135 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 27) JBAS014613: Operation ("add") failed - address: ([

          ("subsystem" => "datasources"),

          ("jdbc-driver" => "mysql")

      ]) - failure description: "JBAS010441: Failed to load module for driver [com.mysql]"

      ...

      00:32:13,923 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "jasperserver.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [

          "jboss.data-source.java:/jdbc/jasperserver is missing [jboss.jdbc-driver.mysql]"

      ]}

       

      What is wrong ??

        • 1. Re: Wildfly 8.1 and mysql
          emmanuel.lesne Newbie

          My standalone.xml file contains

          <subsystem xmlns="urn:jboss:domain:datasources:2.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>

                          <drivers>

                              <driver name="h2" module="com.h2database.h2">

                                  <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                              </driver>

                              <driver name="mysql" module="com.mysql">

                                  <driver-class>com.mysql.jdbc.Driver</driver-class>

                                  <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>

                              </driver>

                          </drivers>

                      </datasources>

                  </subsystem>

          • 2. Re: Wildfly 8.1 and mysql
            Florian Santner Newbie

            Have you installed the mysql module in the server's modules directory?

            That is, do you have a directory in $JBOSS_DIR/modules/com/mysql/main...?

            • 3. Re: Wildfly 8.1 and mysql
              emmanuel.lesne Newbie

              Hi Florian,

               

              Yes I have try :

              1. $JBOSS_HOME/modules and $JBOSS_HOME/modules/system/layer/base...

              2. With mysql driver version mysql-connector-java-5.0.8-bin, mysql-connector-java-5.1.18-bin and mysql-connector-java-5.1.31-bin.

               

              Same result :-(

              • 4. Re: Wildfly 8.1 and mysql
                emmanuel.lesne Newbie

                I was used a file name modules.xml not module.xml.