3 Replies Latest reply on Aug 8, 2011 12:19 AM by ffang

    Exception: No suitable driver found for jdbc:hsqldb:mem:test

    bitec_alisovenko

      Hi.

       

      Trying to use jpa (hibernate) from camel-jpa component. But recieve the following error:

       

      java.sql.SQLException: No suitable driver found for jdbc:hsqldb:mem:test

              at java.sql.DriverManager.getConnection(DriverManager.java:602)[:1.6.0_20]

       

      by camel jpa component:

       

      org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: o

      rg.hibernate.exception.JDBCConnectionException: Cannot open connection

              at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:382)[211:org.springframework.orm:3.0.5.RELEASE]

              at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)[74:org.springframework.transact

      ion:3.0.5.RELEASE]

              at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)[74:org.springframework.transaction:3.0.5.RELEASE]

              at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78)[212:org.apache.camel.camel-jpa:2.6.0.fuse-00-00]

              at org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:51)[212:org.apache.camel.camel-jpa:2.6.0.fuse-00-00]

       

      I changed the hsqldb bundle to be fragment (simply added the "Fragment-Host:" row to Manifest file in the bundle "com.springsource.org.hsqldb-1.8.0.10.jar" from springsource) and deployed it. Everything deployed and run perfectly (it could not be dun ok before, when the hsqldb bundle was not fragment). But when I launch the route, the jpa component fails to get the connection.

       

      Here is the piece of my spring configuration:

      -


       

       

          ><! this is ordinary JPA spring configuration -->

           

       

      and my persistence.xml file:

       

      -


       

       

      Sorry for bad markup

       

      Edited by: bitec on Aug 2, 2011 10:52 AM

        • 1. Re: Exception: No suitable driver found for jdbc:hsqldb:mem:test
          bitec_alisovenko

          I really cannot understand, why hsql driver is not seen... Here is the snapshot for my bundle, you can see, that the hsql driver is the fragment of my bundle, so it should be seen by all related bundles....

           

          Symbolic Name     drfusion-ws

          Version     1.0.0.SNAPSHOT

          Bundle Location     file:/C:/apache-servicemix-4.3.1-fuse-00-00/deploy/drfusion-ws-1.0-SNAPSHOT.jar

          Last Modification     Tue Aug 02 16:12:37 MSD 2011

          Description     DRFusion Web service

          Start Level     60

          Fragments Attached     com.springsource.org.hsqldb (233)

          Exported Packages     com.mycompany.drf.cxf,version=1.0.0.SNAPSHOT

          org.hsqldb,version=1.8.0.10

          org.hsqldb.index,version=1.8.0.10

          org.hsqldb.jdbc,version=1.8.0.10

          org.hsqldb.lib,version=1.8.0.10

          org.hsqldb.lib.java,version=1.8.0.10

          org.hsqldb.persist,version=1.8.0.10

          org.hsqldb.resources,version=1.8.0.10

          org.hsqldb.rowio,version=1.8.0.10

          org.hsqldb.sample,version=1.8.0.10

          org.hsqldb.scriptio,version=1.8.0.10

          org.hsqldb.store,version=1.8.0.10

          org.hsqldb.types,version=1.8.0.10

          org.hsqldb.util,version=1.8.0.10

          org.hsqldb.util.sqltool,version=1.8.0.10

           

          The exception is raised when the spring context is initialised and the database is generated () but this fails:

           

          java.sql.SQLException: No suitable driver found for jdbc:hsqldb:mem:test

                  at java.sql.DriverManager.getConnection(DriverManager.java:602)[:1.6.0_20]

                  at java.sql.DriverManager.getConnection(DriverManager.java:154)[:1.6.0_20]

                  at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)[225:com.springsource.org.hibernate:3.3.2.GA]

                  at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)[225:com.springsource.org.hibernate

          .3.2.GA]

                  at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:252)[225:com.springsource.org.hibernate:3.3.2.GA]

           

          Any help is appreciated!

          • 2. Re: Exception: No suitable driver found for jdbc:hsqldb:mem:test
            bitec_alisovenko

            Ok, I soved this.

             

            HSQL driver should be the bundle not for my own bundle, but for the hibernate itself.

             

            So, I added this row to the Manifest file for hsql bundle:

             

            Fragment-Host: com.springsource.org.hibernate

             

            and finally hibernate managed to connect to hsql db.

             

            Very pity, that this wasn't described anywhere, this is a very common task - to communicate to db through connection pool/orm engine and so on.

            • 3. Re: Exception: No suitable driver found for jdbc:hsqldb:mem:test
              ffang

              Hi,

               

              We've discussed similar issues before, please take a look at

               

              http://fusesource.com/forums/thread.jspa?messageID=9780&#9780

               

              Freeman