6 Replies Latest reply on May 29, 2009 4:23 PM by poundcake

    Getting Exception for Derby Data Source

    alexcc_06

      I am trying to test my MDB with Derby database. I have copied getting error
      org.jboss.deployment.DeploymentException: No ClassLoaders found for: org.jboss.
      dbc.DerbyDatabase; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.jdbc.DerbyDatabase)

      Looks like org.jboss.jdbc.DerbyDatabase is not in my class path. Which jar file contains this class or how can i resolve this error.

        • 1. Re: Getting Exception for Derby Data Source
          andydale

          is the Derby jdbc driver in the /lib directory of the server ??


          Thanks,

          Andy

          • 2. Re: Getting Exception for Derby Data Source
            alexcc_06

            I have copied derby.jar in /lib directory of server but it doesn't contain org.jboss.jdbc.DerbyDatabase class.

            • 3. Re: Getting Exception for Derby Data Source
              nicolas.jouanin

              Hi Alex,

              It seems that the problem doesn't come from Derby, but from a jboss class which is not found , look at the class name : org.jboss.jdbc.DerbyDatabase

              One solution i've found to deploy the datasource is to comment out the two following lines in your -ds.xml file :

               <depends>jboss:service=Derby</depends>
              ...
               <mbean code="org.jboss.jdbc.DerbyDatabase" name="jboss:service=Derby"/>
              


              Here is a sample -ds.xml file:

              <?xml version="1.0" encoding="UTF-8"?>
              
              <!-- The Derby embedded database JCA connection factory config
              $Id: derby-ds.xml 25345 2004-11-03 13:29:58Z loubyansky $ -->
              
              
              <datasources>
               <local-tx-datasource>
              
               <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
               <!-- Datasources are not available outside the virtual machine -->
               <jndi-name>EscapeKDS</jndi-name>
              
               <!-- for in-process persistent db, saved when jboss stops. The
               org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db shutdown -->
               <connection-url>jdbc:derby:${jboss.server.data.dir}${/}derby${/}localDB;create=true</connection-url>
              
               <!-- The driver class -->
               <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
              
               <!-- The login and password -->
               <user-name>sa</user-name>
               <password></password>
              
               <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
               <min-pool-size>5</min-pool-size>
              
               <!-- The maximum connections in a pool/sub-pool -->
               <max-pool-size>20</max-pool-size>
              
               <!-- The time before an unused connection is destroyed -->
               <idle-timeout-minutes>5</idle-timeout-minutes>
              
               <!-- Whether to check all statements are closed when the connection is returned to the pool,
               this is a debugging feature that should be turned off in production -->
               <track-statements/>
              
               <!-- This mbean can be used when using in process persistent derby -->
              <!--
               <depends>jboss:service=Derby</depends>
              -->
               </local-tx-datasource>
              
              <!--
               <mbean code="org.jboss.jdbc.DerbyDatabase" name="jboss:service=Derby"/>
              -->
              </datasources>
              


              PS : Does someone knows where to find that org.jboss.jdbc.DerbyDatabase class, and what it does ?

              • 4. Re: Getting Exception for Derby Data Source
                rolando

                I googled and found this site where you can dowload all the varia jars, including derby-plugin-4.0.4

                http://rpm.pbone.net/index.php3/stat/4/idpl/3691384/com/jboss4-varia-4.0.4-3jpp.noarch.rpm.html

                hope it helps.
                Since it is added to the server/xxx/ib the Derby NPE has gone but another problem shows up:
                13:43:31,828 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca
                :service=DataSourceBinding,name=DerbyDS' to JNDI name 'java:DerbyDS'
                13:43:32,000 WARN [ServiceController] Problem starting service jboss.mq:service
                =PersistenceManager
                javax.management.AttributeNotFoundException: not found: BindName
                at org.jboss.mx.server.AbstractMBeanInvoker.getAttribute(AbstractMBeanIn
                voker.java:335)


                If I remove the hsqldb-ds.xml file this error goes but anohter unfriendly message shows up:

                13:47:12,656 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../dep
                loy/jmx-console.war/
                13:47:12,859 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

                --- MBeans waiting for other MBeans ---
                ObjectName: jboss.ejb:service=EJBTimerService,persistencePolicy=database
                State: CONFIGURED
                I Depend On:
                jboss.jca:service=DataSourceBinding,name=DefaultDS

                ObjectName: jboss.mq:service=StateManager
                State: CONFIGURED
                I Depend On:
                jboss.jca:service=DataSourceBinding,name=DefaultDS
                Depends On Me:
                jboss.mq:service=DestinationManager

                This means that it must be more config to use Derby instead of HSQLDB

                • 5. Re: Getting Exception for Derby Data Source
                  andydale

                  Hi,

                  If you want to use Derby as the default DS you will need to do some more config (i have done this for EJBTimerService and for JMS/MDB)

                  For EJBTimerService, you will need to edit the ejb-timer-service.xml file located in the deploy directory and change the following line

                  <depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>

                  btw, you will only need to do this if your Derby datasource is called something else other than DefaultDS, but seems as you get the error i am assuming yourts is not called DefaultDS.

                  For the JMS/MDB i would suggest copying the "derby-jdbc2-service.xml" from $JBOSS_HOME/doc/examples/jms/ into deploy/jms/ and edit the datsource name as needed. Remove the hsqldb-jdbc2-service.xml and rename hsqldb-jdbc-state-service.xml to derby-jdbc-state-service.xml, and edit the datasource name if needed.

                  Cheers,

                  Andy




                  • 6. Re: Getting Exception for Derby Data Source
                    poundcake

                    org.jboss.jdbc.DerbyDatabase is found in derby-plugin-.jar. It is found in the varia sub-component of JBoss app server. You will need to download the source and run your own build. You might also find the jar if you search the web.