3 Replies Latest reply on Apr 2, 2015 6:22 AM by Kuldeep Sharma

    Failed to load module for [org.apache.derby]

    prateek sharma Newbie

      I'm trying to use the embedded jboss server for integration testing for jpa. But, when I'm running my code, I'm getting two errors.

       

       

      **First Error**:("subsystem" => "datasources"),

          ("jdbc-driver" => "derbyclient-10.6.1.0.jar")

      ]) - failure description: "JBAS010441: Failed to load module for driver [org.apache.derby]"

       

       

      **Second error:**  : org.jboss.msc.service.DuplicateServiceException: Service jboss.data-source.java:/jboss/datasources/jdbc:prateek is already registered"}}

       

       

       

       

      **My module.xml**

       

       

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

          <module xmlns="urn:jboss:module:1.0" name="org.apache.derby">

                  <resources>

                      <resource-root path="derbyclient-10.6.1.0.jar"/>

                  </resources>

                  <dependencies>

          <module name="javax.api"/>

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

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

                  </dependencies>

          </module>

       

       

      M**y standalone.xml driver datasource portion:**

       

       

          <datasources>

                         <datasource jndi-name="java:/jboss/datasources/jdbc:prateek" pool-name="derby_net_sample_appPool" enabled="true" use-ccm="false">

          <connection-url>jdbc:derby://localhost:1527/sample;create=true</connection-url>

                <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>

         

             <driver>derbyclient-10.6.1.0.jar</driver>

              <security>

                          <user-name>***</user-name>

                          <password>***</password>

                      </security>

           

             <validation>

                  <validate-on-match>false</validate-on-match>

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

             </validation>

             <statement>

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

             </statement>

          </datasource>

          

          

          <drivers>

             <driver name="derbyclient-10.6.1.0.jar" module="org.apache.derby">

                             <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>

         

                 <xa-datasource-class>org.apache.derby.jdbc.ClientXADataSource</xa-datasource-class>

             </driver>

          </drivers>

          

                      </datasources>

       

       

       

       

      **MY jbossas-ds.xml:**

       

       

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

          <datasources>

                         <datasource jndi-name="java:/jboss/datasources/jdbc:prateek" pool-name="derby_net_sample_appPool" enabled="true" use-ccm="false">

          <connection-url>jdbc:derby://localhost:1527/sample;create=true</connection-url>

                                                 <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>

         

                      <driver>derbyclient-10.6.1.0.jar</driver>

              <security>

                          <user-name>***</user-name>

                          <password>***</password>

                      </security>

           

             <validation>

                  <validate-on-match>false</validate-on-match>

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

             </validation>

             <statement>

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

             </statement>

          </datasource>

          

          

          <!--<drivers>

             <driver name="derbyclient.jar" module="org.apache.derby">

                 <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>

         

                 <xa-datasource-class>org.apache.derby.jdbc.ClientXADataSource</xa-datasource-class>

             </driver>

          </drivers>-->

          

                      </datasources>

       

       

      **My test-persistence.xml**

       

       

          <persistence version="2.1"

             xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xsi:schemaLocation="

                  http://xmlns.jcp.org/xml/ns/persistence

                  http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

             <persistence-unit name="com.mycompany_JPAProject_ejb_1.0-SNAPSHOTPU">

                <jta-data-source>java:/jboss/datasources/jdbc:prateek</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>

          

      I have tried almost every solution available for net but nothing works for me ..Can anybody specify why I'm getting these errors...Thank you !!

        • 1. Re: Failed to load module for [org.apache.derby]
          Kuldeep Sharma Novice

          First, why you are defining DS two times. define only once that's the reason for second error. For First error, it seems its not loading the jar somehow.

           

          So, try by removing the duplicate DS configuration and check again if you are still getting those exceptions.

           

          Thanks!!

          • 2. Re: Failed to load module for [org.apache.derby]
            prateek sharma Newbie

            Hi Kuldeep!

            Thanks for your reply.  I tried what u said but it did not solve the problem.

            I got this exception:

             

            -------------------------------------------------------------------------------

            Test set: com.mycompany.jpaproject.test.SinBeanTest

            -------------------------------------------------------------------------------

            Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.118 sec <<< FAILURE!

            com.mycompany.jpaproject.test.SinBeanTest  Time elapsed: 0 sec  <<< ERROR!

            org.jboss.arquillian.container.spi.client.container.DeploymentException: Could not deploy to container: {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {

                "Services that were unable to start:" => [

                    "jboss.deployment.unit.\"tds.war\".WeldStartService",

                    "jboss.deployment.unit.\"tds.war\".component.SinBean.START",

                    "jboss.deployment.unit.\"tds.war\".component.SinBean.WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.SinBean.WeldInterceptorBindingsService",

                    "jboss.deployment.unit.\"tds.war\".component.\"com.sun.faces.config.ConfigureListener\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"com.sun.faces.config.ConfigureListener\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.\"javax.faces.webapp.FacetTag\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"javax.faces.webapp.FacetTag\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.apache.catalina.servlets.DefaultServlet\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.apache.catalina.servlets.DefaultServlet\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.apache.jasper.servlet.JspServlet\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.apache.jasper.servlet.JspServlet\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.jboss.as.weld.webtier.jsp.JspInitializationListener\".START",

                    "jboss.deployment.unit.\"tds.war\".component.\"org.jboss.as.weld.webtier.jsp.JspInitializationListener\".WeldInstantiator",

                    "jboss.deployment.unit.\"tds.war\".deploymentCompleteService",

                    "jboss.deployment.unit.\"tds.war\".jndiDependencyService",

                    "jboss.deployment.unit.\"tds.war\".moduleDeploymentRuntimeInformationStart",

                    "jboss.naming.context.java.module.tds.tds.env.\"com.mycompany_JPAProject_ejb_1.0-SNAPSHOTPU\"",

                    "jboss.persistenceunit.\"tds.war#com.mycompany_JPAProject_ejb_1.0-SNAPSHOTPU\"",

                    "jboss.web.deployment.default-host./tds"

                ],

                "Services that may be the cause:" => ["jboss.jdbc-driver.derbyclient-10_6_1_0_jar"]

            }}

            Caused by: java.lang.Exception: {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {

             

                "Services that may be the cause:" => ["jboss.jdbc-driver.derbyclient-10_6_1_0_jar"]

            }}

             

            First error remains the same. I think there is some problem with the driver jar. Server is not founding the driver jar somehow..But I'm not sure

            • 3. Re: Failed to load module for [org.apache.derby]
              Kuldeep Sharma Novice

              Exactly, its not loading driver i.e. jar file. Make sure you are not making any mistakes during DS creation and jar is present on specified location parallel to module.xml file.

               

              Thanks!