The following is the workaround:

<Resource id="jdbc/mcmsJta" type="javax.sql.DataSource">
  JdbcDriver net.sf.hajdbc.sql.DataSource
  UserName ....
  Password ....
  JtaManaged true
  jmxEnabled true
  LogSql false
</Resource>

and had to rename filename from ha-jdbc-cluster.xml to ha-jdbc-null.xml.

still getting errors, but they are related to ha-jdbc, now.


On Sat, Nov 2, 2013 at 9:49 AM, Howard W. Smith, Jr. <smithh032...@gmail.com
> wrote:

> I'm trying to use HA-JDBC[1] with TomEE to have a cluster of at least 2
> databases. As per documentation and forum discussion, I have the following:
>
> --- tomee.xml ---
>
> <Resource id="jdbc/mcmsJta" type="javax.sql.DataSource">
>   factory="net.sf.hajdbc.sql.DataSourceFactory"
>   cluster="cluster"
>   UserName ....
>   Password ...
>   JtaManaged true
>   jmxEnabled true
>   LogSql false
> </Resource>
>
> --- ha-jdbc-cluster.xml ---
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ha-jdbc xmlns="urn:ha-jdbc:cluster:2.1">
>     <sync id="full">
>        <property name="fetchSize">1000</property>
>     </sync>
>     <sync id="diff">
>        <property name="fetchSize">1000</property>
>        <property name="versionPattern">version</property>
>     </sync>
>     <state id="simple"/>
>     <cluster dialect="derby" balancer="simple" default-sync="full"
> meta-data-cache="lazy" transaction-mode="parallel">
>         <database id="db1" weight="1"
> location="org.apache.tomcat.jdbc.pool.DataSource">
>             <user>...</user>
>             <password>...</password>
>             <property name="serverName">mcms</property>
>             <property name="databaseName">mcms</property>
>             <property
> name="driver">org.apache.derby.jdbc.EmbeddedDriver</property>
>             <property
> name="url">jdbc:derby:c:/javadb/databases/mcms;create=true</property>
>             <property name="InitialSize">10</property>
>             <property name="MaxActive">100</property>
>             <property name="MaxIdle">30</property>
>             <property name="MaxWait">10000</property>
>             <property name="minIdle">10</property>
>             <property name="suspectTimeout">60</property>
>             <property name="removeAbandoned">true</property>
>             <property name="removeAbandonedTimeout">180</property>
>             <property name="timeBetweenEvictionRunsMillis">30000</property>
>             <property
> name="jdbcInterceptors">StatementCache(max=128)</property>
>         </database>
>         <database id="db2" weight="2"
> location="org.apache.tomcat.jdbc.pool.DataSource">
>             <user>...</user>
>             <password>...</password>
>             <property name="serverName">mcms</property>
>             <property name="databaseName">mcms</property>
>             <property
> name="driver">org.apache.derby.jdbc.EmbeddedDriver</property>
>             <property
> name="url">jdbc:derby:c:/javadb/databases/mcmsdev;create=true</property>
>             <property name="InitialSize">10</property>
>             <property name="MaxActive">100</property>
>             <property name="MaxIdle">30</property>
>             <property name="MaxWait">10000</property>
>             <property name="minIdle">10</property>
>             <property name="suspectTimeout">60</property>
>             <property name="removeAbandoned">true</property>
>             <property name="removeAbandonedTimeout">180</property>
>             <property name="timeBetweenEvictionRunsMillis">30000</property>
>             <property
> name="jdbcInterceptors">StatementCache(max=128)</property>
>         </database>
>     </cluster>
> </ha-jdbc>
>
>
> which results in the following in the log:
>
>
> INFO: Creating Resource(id=jdbc/mcmsJta)
>
> Nov 02, 2013 9:15:03 AM
> org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource readOnly
> INFO: Disabling testOnBorrow since no validation query is provided
>
> Nov 02, 2013 9:15:03 AM org.apache.openejb.assembler.classic.Assembler
> logUnusedProperties
> WARNING: Property "factory" not supported by "jdbc/mcmsJta"
>
> Nov 02, 2013 9:15:03 AM org.apache.openejb.assembler.classic.Assembler
> logUnusedProperties
> WARNING: Property "cluster" not supported by "jdbc/mcmsJta"
>
> Nov 02, 2013 9:15:03 AM org.apache.openejb.assembler.classic.Assembler
> createRecipe
>
>
> now, my app is not connecting to my database, and it is trying to use
> default database connection (hsqldb, which is probably the non-jta database
> which is configured automatically by tomee, if/when 'no' non-jta database
> is configured/specified in tomee.xml via <Resource ... />.
>
> Should I move the <Resource .../> from tomee.xml to (webapp)
> META-INF/context.xml as recommended here[2]?
>
>
> [1] http://ha-jdbc.github.io/
> [2] https://sourceforge.net/p/ha-jdbc/discussion/383396/thread/4707f208/
>
>

Reply via email to