9 Replies Latest reply on Oct 10, 2012 10:32 AM by sergeib

    jboss 7.1 - installing mysql driver as deployment NOT module

    yashendrac

      I wonder if anybody tried configuring mysql datasource by installing mysql driver in deployments folder as suggested here

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

      Install the JDBC driver as a deployment

      When you install the JDBC driver as a deployment, it is deployed as a regular JAR. This is the recommended way to install the driver.

      .................

      .................

      In AS7 standalone mode, you simply copy the JDBC 4-compliant JAR into the AS7_HOME/standalone/deployments directory.

       

       

      I tried it but I am seeing these messages in log

      JBAS014775:    New missing/unsatisfied dependencies:

            service jboss.jdbc-driver.mysql-connector-java-5_1_18-bin_jar (missing) de

      pendents: [service jboss.data-source.java:/DefaultDS]

       

       

      JBAS014776:    Newly corrected services:

            service jboss.jdbc-driver.mysql-connector-java-5_1_18-bin_jar (no longer r

      equired)

       

       


        • 1. Re: jboss 7.1 - installing mysql driver as deployment NOT module
          yashendrac

          here are my configurations

           

          1. standalone-full.xml

           

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

                      <datasources>

                          <datasource jndi-name="java:/DefaultDS" pool-name="mysqlDS" enabled="true" use-java-context="true">

                              <connection-url>jdbc:mysql://localhost:3306/apollodb</connection-url>

                              <driver>mysql-connector-java-5.1.18-bin.jar</driver>

                              <pool>

                                  <min-pool-size>20</min-pool-size>

                                  <max-pool-size>200</max-pool-size>

                              </pool>

                              <security>

                                  <user-name>xx</user-name>

                                  <password>xx</password>

                              </security>

                          </datasource>

                          <drivers>

                              <driver name="mysql-connector-java-5.1.18-bin.jar" module="com.mysql"/>

                          </drivers>

                      </datasources>

                  </subsystem>

           

          2. copied mysql-connector-java-5.1.18-bin.jar to standalone/deployments

          • 2. Re: jboss 7.1 - installing mysql driver as deployment NOT module
            wdfink

            See wiki, here just the relevant sentence:

             

            Note on MySQL driver and JDBC Type 4 compliance: while the MySQL driver (at least up to 5.1.18) is designed to be a Type 4 driver, its jdbcCompliant() method always return false. The reason is that the driver does not pass SQL 92 full compliance tests, says MySQL. Thus, you will need to install the MySQL JDBC driver as a module (see below).

            • 3. Re: jboss 7.1 - installing mysql driver as deployment NOT module
              yashendrac

              Thanks. I had seen that but then I also saw following steps, and found that mysql-connector-java-5.1.18-bin.jar already has that file in place.

              I had not noticed this: Connector/J Driver reports itself as not jdbc compliant

              Modify the JAR

              The most straightforward solution is to simply modify the JAR and add the missing file.  You can do this from your command shell by:

              1. Change to, or create, an empty temporary directory.
              2. Create a "META-INF" subdirectory.
              3. Create a "META-INF/services" subdirectory.
              4. Create a "META-INF/services/java.sql.Driver" file which contains one line - the fully-qualified class name of the JDBC driver.
              5. Use the "jar" command-line tool to update the JAR like this:

               

              jar -uf jdbc-driver.jar META-INF/services/java.sql.Driver
              • 4. Re: jboss 7.1 - installing mysql driver as deployment NOT module
                wdfink

                It is not the META-INF alone, AFAIK the driver class itselve return false for jdbcCompliant() method.

                • 5. Re: jboss 7.1 - installing mysql driver as deployment NOT module
                  yashendrac

                  Thanks, I will install it as module in place of deploying.

                  • 6. Re: jboss 7.1 - installing mysql driver as deployment NOT module
                    tonykaska

                    Did you install the MySQL driver as module? Were you successful? I am not able to install it successfully. If you can share your experience that will be helpful. Thank you.

                    • 7. Re: jboss 7.1 - installing mysql driver as deployment NOT module
                      wdfink

                      Is it still a problem?

                      How do you proceed? What error messages do you see?

                      • 8. Re: jboss 7.1 - installing mysql driver as deployment NOT module
                        yashendrac

                        As suggested by Fink. I have installed it as module.

                         

                        Created this under jboss 7 modules

                         

                        com\mysql\jdbc\main\

                                                      module.xml

                                                      mysql-connector-java-5.1.18-bin.jar

                         

                         

                        content of module.xml

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

                                <resources>

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

                                </resources>

                                <dependencies>

                                        <module name="javax.api"/>

                                </dependencies>

                        </module>

                         

                         

                         

                        data source configuration under standalone.xml or the one you are using, I use standalone-full.xml

                                    <datasources>

                                        <datasource jndi-name="java:jboss/DefaultDS" pool-name="MySQLDefaultDS" enabled="true" jta="true" use-java-context="true">

                                            <connection-url>jdbc:mysql://localhost:3306/myappdbname</connection-url>

                                            <driver>mysql</driver>

                                                <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                                            <pool>

                                                <min-pool-size>10</min-pool-size>

                                                <max-pool-size>40</max-pool-size>

                                            </pool>

                                            <security>

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

                                                <password>xxx</password>

                                            </security>

                                            <validation>

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

                                                <validate-on-match>

                                                    false

                                                </validate-on-match>

                                                <background-validation>

                                                    false

                                                </background-validation>

                                                <use-fast-fail>

                                                    false

                                                </use-fast-fail>

                                            </validation>

                                            <timeout>

                                                <blocking-timeout-millis>

                                                    5000

                                                </blocking-timeout-millis>

                                            </timeout>

                                        </datasource>

                                        <drivers>

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

                                        </drivers>

                        </datasources>

                        1 of 1 people found this helpful
                        • 9. Re: jboss 7.1 - installing mysql driver as deployment NOT module
                          sergeib

                          Hi Wolf-Dieter Fink.

                          Thank you for help.

                          This works for me.