6 Replies Latest reply on Mar 7, 2012 8:29 AM by yashendrac

    JBoss 7.1 final + MySQL support not working

    jnovotny

      Hi,

       

      In order to configure Jboss 7.1 and Mysql I tried the following based on googling other references:

       

      1. Create directory $JBOSS_7_1$/modules/com/mysql/main

      2. Copy mysql-connector-java-5.1.17-bin.jar into this directory

      3. Create module.xml in this directory:

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

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

        <resources>

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

        </resources>

        <dependencies>

          <module name="javax.api"/>

          <module name="javax.transaction"/>

        </dependencies>

      </module>

       

      4. I edit $JBOSS_7_1$/standalone/configuration/standalone-full-ha.xml    (I use full since I also want JMS support)

       

      eliminate the example datasource and add the following:

       

      <subsystem xmlns="urn:jboss:domain:datasources:1.0">

                  <datasources>

                      <datasource jndi-name="java:/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">

                          <connection-url>

                              jdbc:mysql://localhost:3306/machprod

                          </connection-url>

                          <driver-class>

                              com.mysql.jdbc.Driver

                          </driver-class>

                          <driver>

                              mysql

                          </driver>

                          <transaction-isolation>

                              TRANSACTION_READ_COMMITTED

                          </transaction-isolation>

                          <pool>

                              <min-pool-size>

                               200

                              </min-pool-size>

                              <max-pool-size>

                                  300

                              </max-pool-size>

                              <prefill>

                                  true

                              </prefill>

                              <use-strict-min>

                                  false

                              </use-strict-min>

                              <flush-strategy>

                                  FailingConnectionOnly

                              </flush-strategy>

                          </pool>

                          <security>

                              <user-name>

                                  root

                              </user-name>

                              <password>

                              </password>

                          </security>

                          <validation>

                              <validate-on-match>

                                  false

                              </validate-on-match>

                              <background-validation>

                                  false

                              </background-validation>

                              <use-fast-fail>

                                  false

                              </use-fast-fail>

                          </validation>

                          <statement>

                              <prepared-statement-cache-size>

                                  100

                              </prepared-statement-cache-size>

                              <share-prepared-statements/>

                          </statement>

                      </datasource>

                      <drivers>

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

                      </drivers>

                  </datasources>

              </subsystem>

       

      And then I do:

       

      ./standalone.sh --server-config=standalone-full.xml  (from JBoss/bin)

       

      and I see I get the following error:

       

      12:34:24,900 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report

      JBAS014775:    New missing/unsatisfied dependencies:

            service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.data-source.java:/MySqlDS]

       

       

      What is wrong? Is there a way to enable greater verbosity or at least more useful log messages?

       

      Thanks, Jason

        • 1. Re: JBoss 7.1 final + MySQL support not working
          jnovotny

          <subsystem xmlns="urn:jboss:domain:datasources:1.0">

                      <datasources>

                          <datasource jndi-name="java:/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">

                              <connection-url>

                                  jdbc:mysql://localhost:3306/machprod

                              </connection-url>

                              <driver-class>

                                  com.mysql.jdbc.Driver

                              </driver-class>

                              <driver>

                                  mysql

                              </driver>

                              <transaction-isolation>

                                  TRANSACTION_READ_COMMITTED

                              </transaction-isolation>

                              <pool>

                                  <min-pool-size>

                                      200

                                  </min-pool-size>

                                  <max-pool-size>

                                      300

                                  </max-pool-size>

                                  <prefill>

                                      true

                                  </prefill>

                                  <use-strict-min>

                                      false

                                  </use-strict-min>

                                  <flush-strategy>

                                      FailingConnectionOnly

                                  </flush-strategy>

                              </pool>

                              <security>

                                  <user-name>

                                      root

                                  </user-name>

                                  <password>

                                  </password>

                              </security>

                              <validation>

                                  <validate-on-match>

                                      false

                                  </validate-on-match>

                                  <background-validation>

                                      false

                                  </background-validation>

                                  <use-fast-fail>

                                      false

                                  </use-fast-fail>

                              </validation>

                              <statement>

                                  <prepared-statement-cache-size>

                                      100

                                  </prepared-statement-cache-size>

                                  <share-prepared-statements/>

                              </statement>

                          </datasource>

                          <drivers>

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

                          </drivers>

                      </datasources>

                  </subsystem>

           

           

           

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

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

            <resources>

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

            </resources>

            <dependencies>

              <module name="javax.api"/>

              <module name="javax.transaction"/>

            </dependencies>

          </module>

          • 2. Re: JBoss 7.1 final + MySQL support not working
            rhanus

            I use mysql-5.1.17 in standalone without any problem

            only difference is that I don't define driver-class in datasource and have following driver definition:

                            <driver name="mysql" module="com.mysql.jdbc">
                                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                            </driver>

             

            btw do you see file mysql-connector-java-5.1.17-bin.jar.index in $JBOSS_7_1$/modules/com/mysql/main ?

            • 3. Re: JBoss 7.1 final + MySQL support not working
              jnovotny

              Yes, I do see that file. I couldn't get anywhere but a colleague zipped up the module directory containing mysql and after unpacking that worked. Very strange.

              • 4. Re: JBoss 7.1 final + MySQL support not working
                rhanus

                you also might do a typo inside module.xml see here

                • 5. Re: JBoss 7.1 final + MySQL support not working
                  yashendrac

                  You have mentioned you modified standalone-full-ha.xml but you aren't running full-ha profile.

                  You are executing ./standalone.sh --server-config=standalone-full.xml  (from JBoss/bin)

                  That means you should configure datasource in standalone-full.xml NOT in standalone-full-ha.xml?

                  • 6. Re: JBoss 7.1 final + MySQL support not working
                    yashendrac

                    I am also seeing this problem.

                    Only difference is I am installing the driver as deployment NOT as module, as MySQ ldrive is JDBC-4 compliant.

                    Has anybody tried installing mysql-connector-java-5.1.18-bin as deployment in place of installing as module and creating module.xml, as suggested here

                    https://docs.jboss.org/author/display/AS71/Developer+Guide#DeveloperGuide-UpdatetheDataSourceConfiguration