Menu

Can't start HA-JDBC

Help
garwind
2008-12-10
2012-09-28
  • garwind

    garwind - 2008-12-10

    Hello,

    I try to use HA JDBC with my application. We use Hibernate and sring. The application server is jboss. I got this exception at start, whereas I put needed libs in the lib directory ( I test to put it in every lib directory).

    2008-12-10 17:46:20,199 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
    org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
    at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:190)
    ...
    Caused by: java.lang.reflect.UndeclaredThrowableException
    at org.jboss.resource.JBossResourceException.process(JBossResourceException.java:204)
    at org.jboss.resource.JBossResourceException.<init>(JBossResourceException.java:111)
    ... 114 more
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.hajdbc.sql.Driver

    My configuration files are :

    Datasource :
    <connection-url>jdbc:ha-jdbc:cluster1</connection-url>
    <driver-class>net.sf.hajdbc.sql.Driver</driver-class>
    <user-name>...</user-name>
    <password>...</password>

    Dialect : org.hibernate.dialect.PostgreSQLDialect

    <ha-jdbc>
    <sync id="passive" class="net.sf.hajdbc.sync.PassiveSynchronizationStrategy"></sync>
    <cluster id="cluster1" balancer="simple" dialect="PostgreSQL" default-sync="passive" meta-data-cache="none" transaction-mode="parallel">
    <database id="database1">
    <driver>org.postgresql.Driver</driver>
    <url>jdbc:postgresql://.../...</url>
    <user>...</user>
    <password>...</password>
    </database>
    <database id="database2">
    <driver>org.postgresql.Driver</driver>
    <url>jdbc:postgresql://.../...</url>
    <user>...</user>
    <password>...</password>
    </database>
    </cluster>
    </ha-jdbc>

    I try to replace an hibernate postgresql configuration ... but without success.

    Thanks for your help !

     
    • garwind

      garwind - 2008-12-11

      Ok.

      I fix the jars.

      Now I get another exception at start :

      2008-12-11 10:58:45,958 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Na pas fermé le raccordement à la base de données: {0})
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:190)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:619)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:264)
      ...

      Apparently he couldn't close connection to database.

      I try to change dialect settings in my hibernate without success. I don't see what it could be.

      Thanks.

       
      • Paul Ferraro

        Paul Ferraro - 2008-12-15

        There are 2 issues here:
        1. The translation of the error message is unfortunately wrong...
        If your locale was english you would see the correct error message:
        Failed to locate database cluster configuration file: {0}

        1. There is a quoting error in the error message resource bundle which is preventing the {0} parameter from being formatted in the message. This parameter would indicate where ha-jdbc tried to look to find its configuration file.

        I'll fix these 2 issues in 2.0.14.

        To workaround the above issues, try starting your server with the following additional system properties:
        -Duser.region=US -Duser.language=en

        Once you see the proper error message, make sure that HA-JDBC can find your configuration file. The algorithm used by HA-JDBC to find it's configuration file is defined here:
        http://ha-jdbc.sourceforge.net/doc.html#config

         
    • Paul Ferraro

      Paul Ferraro - 2008-12-11

      Your classpath is likely missing either the ha-jdbc jar or one or more of its dependencies. The dependencies are contained in the /lib, and /lib/runtime directories of the binary distribution. This is documented here:
      http://ha-jdbc.sourceforge.net/doc.html#dependencies

       

Log in to post a comment.