4 Replies Latest reply on Oct 1, 2013 2:09 AM by Jose Alvarez de Lara

    different hsqldb version issue

    Jose Alvarez de Lara Novice

      Let me see if I can explain my problem in my very poor english.

      I have developed a maven hibernate webapp where I attack a hsqldb database that is configured

      in the persistenc.xml file as follows,

       

      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
        <persistence-unit name="forge-default" transaction-type="JTA">
          <description>Forge Persistence Unit</description>
          <provider>org.hibernate.ejb.HibernatePersistence</provider>
          <jta-data-source>java:jboss/datasources/MyWebDS</jta-data-source>
          <class>com.example.hibernate.jpa.model.Customer</class>
          <class>com.example.hibernate.jpa.model.Employee</class>
          <class>com.example.hibernate.jpa.model.Office</class>
          <class>com.example.hibernate.jpa.model.Orderdetail</class>
          <class>com.example.hibernate.jpa.model.Order</class>
          <class>com.example.hibernate.jpa.model.Payment</class>
          <class>com.example.hibernate.jpa.model.Productline</class>
          <class>com.example.hibernate.jpa.model.Product</class>
          <exclude-unlisted-classes>false</exclude-unlisted-classes>
          <properties>
            <property name="hibernate.connection.username" value="sa"/>
            <property name="hibernate.connection.url" value="jdbc:hsqldb:hsql://localhost:1701"/>
            <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
          </properties>
        </persistence-unit>
      </persistence>
      

       

      I have downloaded the employee-hsqldb.zip file from a tutorial of Jboss but I can not remember the url of the document.

       

      The problem in question is that the apps server Jboss EAP 6.1 has its own hsqldb implementation in the standalone.xml file as follows,

       

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

                  <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>

                  <driver>h2</driver>

                  <security>

                         <user-name>sa</user-name>

                         <password>sa</password>

                  </security>

      </datasource>

       

      this is for the default DS and here is my DS,

       

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

                  <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>

                  <driver>h2</driver>

                  <security>

                         <user-name>sa</user-name>

                  </security>

      </datasource>

       

      but when I test the connection from the admin console I get the following error,

       

      Unknown error

      Unexpected HTTP response: 500

       

      Request

      {

          "address" => [

              ("subsystem" => "datasources"),

              ("data-source" => "MyWebDS")

          ],

          "operation" => "test-connection-in-pool"

      }

       

      Response

       

      Internal Server Error

      {

          "outcome" => "failed",

          "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",

          "rolled-back" => true

      }

       

      So I wonder if this issue is caused because a different version of the hsqldb.jar file being the resident one in Jboss EAP 6.1 the version 1.3 and the one downloaded the version 1.8 existing incompatibility between them.

       

      On the other hand JBDS 7 lets me configure the database with the url jdbc:hsqldb:hsql://localhost:1701.

      Here is the exception I get in JBDS / console when I test the connection,

       

      15:47:51,793 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (HttpManagementService-threads - 6) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282) [ironjacamar-jdbc-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240) [ironjacamar-jdbc-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:782) [ironjacamar-core-impl-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:345) [ironjacamar-core-impl-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397) [ironjacamar-core-impl-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365) [ironjacamar-core-impl-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.internalTestConnection(AbstractPool.java:627) [ironjacamar-core-impl-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.jca.core.connectionmanager.pool.strategy.OnePool.testConnection(OnePool.java:88) [ironjacamar-core-impl-1.0.15.Final.jar:1.0.15.Final]
          at org.jboss.as.connector.subsystems.common.pool.PoolOperations$TestConnectionInPool.invokeCommandOn(PoolOperations.java:143) [jboss-as-connector-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.connector.subsystems.common.pool.PoolOperations$1.execute(PoolOperations.java:82) [jboss-as-connector-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:440) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:322) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:229) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:224) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:142) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:112) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.ModelControllerImpl$2.execute(ModelControllerImpl.java:338) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.controller.ModelControllerImpl$2.execute(ModelControllerImpl.java:328) [jboss-as-controller-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
          at org.jboss.as.domain.http.server.DomainApiHandler.processRequest(DomainApiHandler.java:320)
          at org.jboss.as.domain.http.server.DomainApiHandler.doHandle(DomainApiHandler.java:226)
          at org.jboss.as.domain.http.server.DomainApiHandler.handle(DomainApiHandler.java:233)
          at org.jboss.as.domain.http.server.security.SubjectAssociationHandler.handle(SubjectAssociationHandler.java:51)
          at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78)
          at org.jboss.sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:69)
          at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81)
          at org.jboss.sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:710)
          at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78)
          at org.jboss.as.domain.http.server.RealmReadinessFilter.doFilter(RealmReadinessFilter.java:47)
          at org.jboss.as.domain.http.server.DmrFailureReadinessFilter.doFilter(DmrFailureReadinessFilter.java:45)
          at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81)
          at org.jboss.sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:682)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
          at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final.jar:2.1.0.Final]
      Caused by: javax.resource.ResourceException: Wrong driver class [class org.h2.Driver] for this connection URL [jdbc:hsqldb:hsql://localhost:1701]
          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:256) [ironjacamar-jdbc-1.0.15.Final.jar:1.0.15.Final]
          ... 34 more
      

       

      Please, where am I getting wrong?

       

      Thanks,

      jose

        • 1. Re: different hsqldb version issue
          Jose Alvarez de Lara Novice

          Excuse me, I think I did not expose my question clearly.

           

          In Jboss EAP 6.1 exists an hsqldb database with its default configuration.

          What I pretend is to add another hsqldb database coexisting both in the

          same apps server.

           

          How can I do it?

           

          Thanks,

          jose

          • 2. Re: different hsqldb version issue
            Jose Alvarez de Lara Novice

            Take a look at this web,

             

            http://markmail.org/message/b3ws4nitw5ceatzu#query:+page:1+mid:h2bhqzjhpltg3tp4+state:results

             

            It seems that exist an issue when installing HSQLDB 1.8.x.

             

            Please study it and give me an answer.

            • 3. Re: different hsqldb version issue
              jaikiran pai Master

              I don't fully know if the problem is because of the existing ExampleDS or because of some library conflict. But anyway, you can just delete/comment out the ExampleDS datasource section from your standalone configuration file since that ExampleDS is not used anywhere and is only there as an example.

              • 4. Re: Re: different hsqldb version issue
                Jose Alvarez de Lara Novice

                Thanks jaikiran for your suggestion. I did it and I get an error with the new jar library,

                 

                Unknown error
                
                Unexpected HTTP response: 500
                
                Request
                {
                    "address" => [
                        ("subsystem" => "datasources"),
                        ("data-source" => "MyWebDS")
                    ],
                    "operation" => "test-connection-in-pool"
                }
                
                Response
                
                Internal Server Error
                {
                    "outcome" => "failed",
                    "failure-description" => "JBAS010440: failed to invoke operation: JBAS010442: failed to match pool.
                                 Check JndiName: java:jboss/datasources/MyWebDS",
                    "rolled-back" => true
                }
                
                
                
                
                
                
                

                 

                Here is what the boot of JBoss EAP 6.1 says,

                 

                07:35:51,087 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
                JBAS014775:    New missing/unsatisfied dependencies:
                      service jboss.jdbc-driver.h2 (missing) dependents: [service jboss.driver-demander.java:jboss/datasources/MyWebDS, service jboss.data-source.java:jboss/datasources/MyWebDS]
                
                
                

                 

                This is what I did,

                1) In the folder /com/h2database/h2/main I put the jar library and updated the module.xml file

                2) In the standalone.xml file I commented out the ExampleDS and put the new MyWebDS configuration

                 

                Do I miss anything?

                Maybe it should be a libary with errors, I attach the zip file with the whole example