2 Replies Latest reply on Jan 1, 2011 8:50 AM by Sakari Isoniemi

    using Cloudscape/Derby as Datasource

    netanel weinberg Newbie

      Hello!

      I want to use Cloudscape/Derby as a Datasource for my ejbs and jms.
      can any one can explain me how to configure the xml files to work with Cloudscape/Derby?


      Thank you,
      Netanel

        • 1. Re: using Cloudscape/Derby as Datasource
          Sakari Isoniemi Newbie

          Looking for same information.

           

          I have troubles with Derby JDBC Urls.

           

          In some tools the Derby database path in system must be spesified in jdbc url for ex.

           

             jdbc:derby://localhost:1527/C:\Programs\Java\db-derby-10.5.3.0-bin\CustomerDB

           

          Currently I have a problem with JBoss AS 6 Final Derby datasource definitions.

           

          The exception below "java.lang.ClassNotFoundException: org.jboss.jdbc.DerbyDatabase"

          claims that driver class is not found although I have put the derby jars to server lib directory

          ( derby.jar, derbyclient.jar, derby-plugin.jar )

           

          2010-12-30 23:42:32,419 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to Instantiated:
             name=jboss:service=Derby state=Described mode=Manual requiredState=Configured: java.lang.ClassNotFoundException: org.jboss.jdbc.DerbyDatabase from BaseClassLoader@7c3e4b{vfs:///C:/Programs/Java/JBoss/jboss-6.0.0.Final/server/default/deploy/ElectrWireGen2-ds.xml}
          at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:480) [jboss-classloader.jar:2.2.0.GA]
          at java.lang.ClassLoader.loadClass(ClassLoader.java:248) [:1.6.0_17]
          at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1216) [:6.0.0.GA]
          at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:288) [:6.0.0.GA]
          at org.jboss.system.ServiceCreator.installPlainMBean(ServiceCreator.java:217) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]
          at org.jboss.system.ServiceCreator.install(ServiceCreator.java:133) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]
          at org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:73) [:2.2.0.GA]
          at org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:46) [:2.2.0.GA]
          at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]
          at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]
          at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]

           

           

          The datasource definition in ../server/default/deploy directory is

           

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE datasources
              PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
              "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
          <datasources>
            
             <local-tx-datasource>
                <jndi-name>ElectrWireGen2Datasource</jndi-name>
                <use-java-context>false</use-java-context>
                <connection-url>jdbc:derby://localhost:1527/C\:/Programs/Java/db-derby-10.5.3.0-bin/ElectricWiringsDB</connection-url>
                <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
                <user-name>me</user-name>
                <password>mine</password>
             </local-tx-datasource>
            
             <mbean code="org.jboss.jdbc.DerbyDatabase" name="jboss:service=Derby">
              <attribute name="Database">C\:/Programs/Java/db-derby-10.5.3.0-bin/ElectricWiringsDB</attribute>
             </mbean>  
             
          </datasources>

          • 2. Re: using Cloudscape/Derby as Datasource
            Sakari Isoniemi Newbie

            Hello,

             

            This problem is solved in my case.

             

            The Derby was in separate process (JVM) so in seam-gen databse driver

            must be given as 'org.apache.derby.jdbc.ClientDriver' and

            hibernate.connection.dataSource_class=org.apache.derby.jdbc.ClientDataSource

             

            Now the application works with other tables but not with table Component, because it is reserved for Seam, JSF ?
            The name of this table must be changed.

            Good articles relatde to JBoss Derby configurations are

            http://alistairisrael.wordpress.com/2009/03/31/creating-derby-datasource-in-jboss/
            http://www.coderanch.com/t/217343/ORM/java/help-configuring-Jboss-EJB-Derby      
            http://beatgates.blogspot.com/2009/04/run-glassfish-v2-ejb3-example-on-jboss.html
            http://sites.google.com/site/olivabianco/java-blog/jbossderbyhowtoconfigure

             

            Remember this EmbeddedDriver vs. ClientDriver matter.   ( See from Derby docs)