1 2 Previous Next 19 Replies Latest reply on Feb 19, 2014 2:06 PM by swilliams7996

    Datasource Configuration

    swilliams7996

      I'm trying to configure my MySQL database with Jboss and keep getting this error.

       

      JBAS014775:    New missing/unsatisfied dependencies:

      service jboss.jdbc-driver.com_mysql (missing) dependents: [service jboss.data-source.java:jboss/datasources/test]

      16:22:45,623 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.0.Final "Thunder" started (with errors) in 4932ms - Started 135 of 209 services (2 services failed or missing dependencies, 70 services are passive or on-demand)

       

      This is my module:

      <?xmlversion= "1.0" encoding="UTF-8"?>

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

        <resources>

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

        </resources>

        <dependencies>

          <module name="javax.api"/>

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

          <module name="javax.servlet.api" optional="true"/>

        </dependencies>

      </module>

      This is my Persistence XML:

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

      persistence version="2.0" 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">

      <persistence-unit name="HelloWorld">

       

      <jta-data-source>java:jboss/datasources/test</jta-data-source>

      <class>model.MyUser</class>

      </persistence-unit>

      persistence>

       

      My standalone XML:

      xml version='1.0' encoding='UTF-8'?>

      server xmlns="urn:jboss:domain:1.1">

      <subsystem xmlns="urn:jboss:domain:datasources:1.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</connection-url>


      <driver>h2</driver>


      <security>


      <user-name>sa</user-name>


      <password>sa</password>


      </security>


      </datasource>


      <datasource jndi-name="java:jboss/datasources/test" pool-name="test" enabled="true" use-java-context="true">


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


      <driver>com.mysql</driver>

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


      <pool>


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


      <max-pool-size>100</max-pool-size>


      <prefill>true</prefill>

      </pool>

      <security>

      <user-name>sa</user-name>


      <password>sa</password>

      </security>


      <statement>

      <prepared-statement-cache-size>32</prepared-statement-cache-size>

      <share-prepared-statements/>

      </statement>


      </datasource>

      <drivers>


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

      </driver>


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


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


      </driver>


      </drivers>

      </datasources>

       

      I hope someone can help me with this.
      Thank you in advance.

        • 1. Re: Datasource Configuration
          wdfink

          Should be a module problem.

           

          Where is your model.xml and driver jar?

          You should copy this to .../modules/com/mysql/main.

           

          Look to the previous log messages where there is a message that the driver is (not) installed.

          See this Data Source Configuration in AS 7

          • 2. Re: Datasource Configuration
            swilliams7996

            Here is a picture of my module.xml, I think I'm doing it right.

            20140131_113020.jpg

            • 3. Re: Datasource Configuration
              wdfink

              You should look into the server-log and check whether the module is correct loaded or see what the fail message tells.

              • 4. Re: Datasource Configuration
                swilliams7996

                I will do that and see what I can find but it seem like I've done everything right.

                • 5. Re: Datasource Configuration
                  swilliams7996

                  Should I take the default datasource out of the standalone.xml ? Which is:

                   

                  datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">

                   


                  • 6. Re: Datasource Configuration
                    wdfink

                    You might use that as example. But from the message it looks like a driver/module installation problem

                    • 7. Re: Datasource Configuration
                      swilliams7996

                      Yes, but the question was do I need the default datasource in there?

                      • 8. Re: Datasource Configuration
                        wdfink

                        No you can delete the default DS if you did not need it as AS7 did not use this to store ejb-timers etc. as this was in former versions

                        • 9. Re: Datasource Configuration
                          swilliams7996

                          I'm still having problem with this and I'm just running out of ideas, this is my standalone.xml file:

                          <datasources>

                          <datasource jndi-name="java:jboss/datasources/test" pool-name="test" enabled="true" use-java-context="true">

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

                          <driver>com.mysql</driver>

                          <security>

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

                          <password>tigers1lions1</password>

                          </security>

                          </datasource>

                          <drivers>

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

                          </driver>

                          </drivers>

                          </datasources>

                           

                          This is my module:

                          <?xmlversion= "1.0" encoding="UTF-8"?>

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

                            <resources>

                              <resource-root path="mysql-connector-java-5.1.29-bin"/>

                            </resources>

                            <dependencies>

                              <module name="javax.api"/>

                               </dependencies>

                          </module>

                          I'm still getting the message:

                          JBAS014775:    New missing/unsatisfied dependencies:

                          service jboss.jdbc-driver.com_mysql (missing) dependents: [service jboss.data-source.java:jboss/datasources/test]

                          • 10. Re: Datasource Configuration
                            wdfink

                            I'm confused.

                            Now you state that this <resource-root path="mysql-connector-java-5.1.29-bin"/> is in you module.xml.

                            That is definitive wrong and you should see a message that the file can not be loaded if you have a *.jar in your modules/com/mysql/main directory

                            Or did you copy the wrong mysql driver file into the directory?

                            • 11. Re: Datasource Configuration
                              swilliams7996

                              Hi, I didn't copy it wrong. I added a new driver which is mysql-connector-java-5.1.29-bin When I go and see the directory where it is, I copy it which is a jar file but when I copy it, it comes without the .jar extenion. Should I add that .jar to the end? Maybe it's something I don't understand about jar file. I copy it as it is from  the MySQL: Connector J folder.

                              • 12. Re: Datasource Configuration
                                wdfink

                                How do you copy the file? It should not change the suffix.

                                 

                                I've checked that the module worked without .jar.

                                You should see this in the logfile

                                    Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)

                                 

                                But from your copy I suppose that the driver jar might not a valid jar and the modul will not correct installed

                                • 13. Re: Datasource Configuration
                                  dave51

                                  Here's my datasouce , I'm using Ibm Db2 database:

                                  The path: /home/java/jboss-7.1.1/standalone/configuration/standalone.xml

                                   

                                  <datasources>

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

                                                      <connection-url>jdbc:db2://db2svi.xxxxx.it:50000/DB2S</connection-url>

                                                      <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>

                                                      <driver>db2</driver>

                                                      <pool>

                                                          <min-pool-size>0</min-pool-size>

                                                          <max-pool-size>30</max-pool-size>

                                                      </pool>

                                                      <security>

                                                          <user-name>DAVE51</user-name>

                                                          <password>XXXXX</password>

                                                      </security>

                                                  </datasource>

                                                  <drivers>

                                                      <driver name="db2" module="com.ibm.db2">

                                                          <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>

                                                      </driver>

                                                  </drivers>

                                              </datasources>

                                   

                                  The IBM Db2 drivers are here:

                                  /home/java/jboss-7.1.1/modules/com/ibm/db2/main

                                  • 14. Re: Datasource Configuration
                                    swilliams7996

                                    Okay, I finally figure it out. Make sure to call the jar driver the exact name in the driver section as in the module.xml file, most of the details on this says to put this in the driver section:<driver name="mysql" module="com.mysql"> but in the module.xml jar and module in driver section has to be the exact name like this:

                                    <drivers>

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

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

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

                                    </driver>

                                    </drivers>

                                     

                                    This is the module.xml file:

                                    This is my module:

                                    <?xmlversion= "1.0" encoding="UTF-8"?>

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

                                      <resources>

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

                                      </resources>

                                      <dependencies>

                                        <module name="javax.api"/>

                                         </dependencies>

                                    </module>

                                    1 2 Previous Next