JBoss Community

Could not enlist in transaction on entering meta-aware object! (Posgres + SQLite))

reply from Fidox 666 in Datasource Configuration - View the full discussion

I think the error was as follows:

 

1) Data source type "local-tx-datasource" does not support multiple data sources (sqlite and postgresql concurrent transactions). The solution here is to change the type of data source from "local-tx-datasource" to "xa-datasource"

 

 

 

2) Also sqlite does not support "xa-datasource" type (specifically the problem with sqlite was that I could not find an sqlite implementation of the class "

rg.postgresql.xa.PGXADataSource", (*) maybe you can find one for mysql :) ), so I change the second data source database from sqlite to postgresql.

 

 

This is my "old" data source file:

 

<datasources>

<!-- Postgresql -->

<local-tx-datasource>

<jndi-name>Postgres1DS</jndi-name>

<connection-url>jdbc:postgresql://localhost:5432/db0</connection-url>

<driver-class>org.postgresql.Driver</driver-class>

<user-name>user1</user-name>

<password>u1pass</password>

</local-tx-datasource>


<!-- SQLite -->

<local-tx-datasource>

<jndi-name>Sqlite1DS</jndi-name>

<connection-url>jdbc:sqlite:${jboss.server.data.dir}${/}db1.db</connection-url>

<driver-class>org.sqlite.JDBC</driver-class>

<user-name>user1</user-name>

<password>u1pass</password>

<connection-property name="autoReconnect">true</connection-property>

</local-tx-datasource>

</datasources>

 

 

And this is the "new one":

 

 

<datasources>

<!-- Postgresql -->

 

 

 

   <xa-datasource>
<jndi-name>Postgres1DS</jndi-name>
       <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
       <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
       <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
       <xa-datasource-property name="DatabaseName">db0</xa-datasource-property>
       <xa-datasource-property name="User">user1</xa-datasource-property>
       <xa-datasource-property name="Password">u1pass</xa-datasource-property>
       <track-connection-by-tx></track-connection-by-tx>
    </xa-datasource>

<!-- Postgresql -->

 

 

    <xa-datasource>

       <jndi-name>Postgres2DS</jndi-name>

       <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>

 

       <xa-datasource-property name="ServerName">localhost</xa-datasource-property>

       <xa-datasource-property name="PortNumber">5432</xa-datasource-property>

       <xa-datasource-property name="DatabaseName">db1</xa-datasource-property>

       <xa-datasource-property name="User">user1</xa-datasource-property>

       <xa-datasource-property name="Password">u1pass</xa-datasource-property>

       <track-connection-by-tx></track-connection-by-tx>

</xa-datasource>

 

So.. what I suggest you is to change the type of your data sources from "local-tx-datasource" to "xa-datasource", as I say (*).. you must to find a mysql implementation of the class "

xa-datasource-class",

and finally if you can not found this class, you should change the mysql database to postgresql.

 

I hope I have been clear enough, if you find another point of view for this problem please let me know, sorry for my poor english.

 

Best regards..
Fido

 

 

 

 

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community