8 Replies Latest reply on Oct 23, 2012 10:57 AM by panipsilos

    Cannot configure datasource in JBoss AS 7

    panipsilos

      Hi guys 

       

       

      I ve trying for quite some time to configure a datasource in my application , nothing works. I get various errors , and the latest is the following:

       

      New missing/unsatisfied dependencies:

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

       

      13:44:34,806 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/MysqlDSjboss.jdbc-driver.mysqlMissing[jboss.data-source.jboss/datasources/MysqlDSjboss.jdbc-driver.mysql]"]}

       

      I ve read the related thread but nothing really helped me. I guess I something is wrong with my configuration. Below you can the persistence.xml , the -ds.xml and the standalone.xml file. Could someone have a look and tell me if there is a problem with these files? .Thank you

       

      ################## 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="ResearchManagement.Data">    

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

            <properties>

               <!-- Properties for Hibernate -->

               <property name="hibernate.hbm2ddl.auto" value="create-drop" />

               <property name="hibernate.show_sql" value="false" />

            </properties>

         </persistence-unit>

      </persistence>

       

      ################## -ds.xml #################

       

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

      <!-- This is an unmanaged datasource. It should be used for proofs of concept

      or testing only. It uses H2, an in memory database that ships with JBoss

      AS. -->

      <datasources xmlns="http://www.jboss.org/ironjacamar/schema"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

         <!-- The datasource is bound into JNDI at this location. We reference

      this in META-INF/persistence.xml -->

       

         <datasource jndi-name="java:jboss/datasources/MysqlDS"

            pool-name="MysqlDS" enabled="true"

            use-java-context="true">

            <connection-url>jdbc:mysql://127.5.54.1:3306/researchprojects</connection-url>

            <driver>mysql</driver>

            <security>

               <user-name>admin</user-name>

               <password>admin</password>

            </security>

         </datasource>

      </datasources>

       

      ################## standalone.xml #################

       


      <datasources>

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

      <connection-url>jdbc:h2:${jboss.server.data.dir}/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/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS">

      <connection-url>jdbc:mysql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>

      <driver>mysql</driver>

      <security>

      <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name>

      <password>${env.OPENSHIFT_DB_PASSWORD}</password>

      </security>

      <validation>

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


      </validation>

      </datasource>

      <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true">

      <connection-url>jdbc:postgresql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>

      <driver>postgresql</driver>

      <security>

      <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name>

      <password>${env.OPENSHIFT_DB_PASSWORD}</password>

      </security>

      <validation>

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


      </validation>

      </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.jdbc">

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

      </driver>

      <driver name="postgresql" module="org.postgresql.jdbc">

      <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>

      </driver>

      </drivers>

      </datasources>
        • 1. Re: Cannot configure datasource in JBoss AS 7
          nickarls

          show the com.mysql.jdbc driver structure and module.xml.

          • 2. Re: Cannot configure datasource in JBoss AS 7
            panipsilos

            ############ Module.xml #############

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

              <resources>

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

              </resources>

              <dependencies>

                <module name="javax.api"/>

              </dependencies>

            </module>

             

             

            jboss-as-7.1.1.Final\modules\com\mysql\main

             

            I just noticed that the module name should be : "com.mysql.jdbc ,. However the problem still remains

            • 3. Re: Cannot configure datasource in JBoss AS 7
              nickarls

              Restarted the server? Exactly the same trace? What is the directory structure and contents of your module dir? Tried adding the driver class name in standalone.xml driver section?

              • 4. Re: Cannot configure datasource in JBoss AS 7
                panipsilos

                14:55:38,910 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "SvnToyApplication.war"

                14:55:39,378 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015893: Encountered invalid class name 'com.sun.faces.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor' for service type 'com.sun.faces.spi.injectionprovider'

                14:55:39,378 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015893: Encountered invalid class name 'com.sun.faces.vendor.Jetty6InjectionProvider:org.mortbay.jetty.plus.annotation.InjectionCollection' for service type 'com.sun.faces.spi.injectionprovider'

                14:55:39,379 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for ResearchManagement.Data

                14:55:39,909 INFO  [org.jboss.as] (MSC service thread 1-1) JBAS015951: Admin console listening on http://127.0.0.1:9990

                14:55:39,909 ERROR [org.jboss.as] (MSC service thread 1-1) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 2670ms - Started 220 of 366 services (68 services failed or missing dependencies, 76 services are passive or on-demand)

                14:55:40,127 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "SvnToyApplication.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/MysqlDSjboss.jdbc-driver.mysqlMissing[jboss.data-source.jboss/datasources/MysqlDSjboss.jdbc-driver.mysql]"]}

                14:55:40,127 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010409: Unbound data source [jboss/datasources/MysqlDS]

                14:55:40,143 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment SvnToyApplication.war in 28ms

                14:55:40,159 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

                JBAS014775:    New missing/unsatisfied dependencies:

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

                 

                14:55:40,159 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/MysqlDSjboss.jdbc-driver.mysqlMissing[jboss.data-source.jboss/datasources/MysqlDSjboss.jdbc-driver.mysql]"]}}}

                 

                Yes I get exactly the same trace.

                 

                "What is the directory structure and contents of your module dir". Which exact module are you refering to ? The "mysql" module? It s the : jboss-as-7.1.1.Final\modules\com\mysql\main and contains the following drivers:

                mysql-connector-java-5.1.21-bin.jar

                mysql-connector-java-5.1.22-bin.jar

                 

                Well I added the driver in the standalone.xml but still same error

                • 5. Re: Cannot configure datasource in JBoss AS 7
                  nickarls

                  try making the module structure match the name com\mysql\jdbc

                  • 6. Re: Cannot configure datasource in JBoss AS 7
                    panipsilos

                    hmm I did it , but JBoss could not even start: It looks for the "main" folder. Any other suggestions?? I m becoming hopeless

                     

                    15:19:55,135 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

                    15:19:55,696 ERROR [org.jboss.as.jpa] JBAS011405: Could not load default persistence provider module.  : org.jboss.modules.ModuleNotFoundException: Module com.mysql:main is not found in local module loader @45490eb5 (roots: B:\Software\jboss-as-7.1.1.Final\modules)

                        at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.Module.addPaths(Module.java:841) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.Module.link(Module.java:1181) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.Module.relinkIfNecessary(Module.java:1207) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.as.jpa.persistenceprovider.PersistenceProviderLoader.loadProviderModuleByName(PersistenceProviderLoader.java:59) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.as.jpa.persistenceprovider.PersistenceProviderLoader.loadDefaultProvider(PersistenceProviderLoader.java:48) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.as.jpa.subsystem.JPAExtension.initialize(JPAExtension.java:111) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:88) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:127) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:113) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [rt.jar:1.6.0_32]

                        at java.util.concurrent.FutureTask.run(Unknown Source) [rt.jar:1.6.0_32]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_32]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_32]

                        at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_32]

                        at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

                    • 7. Re: Cannot configure datasource in JBoss AS 7
                      nickarls

                      match the standalone.xml module name with the module structure (+the main part) and the name in module.xml. either use the jdbc part or don't in the name

                      • 8. Re: Cannot configure datasource in JBoss AS 7
                        panipsilos

                        Nicklas thnx a lot. That wokred!!!!.Indeed I need to match the standalone.xml module with the module structure and the module.xml.