Atomikos Forum

No rollback at exception?

My problem could be related to this thread: default82df.html?community.6.2610.7. Has there been any progress?

I am doing some tests integrating Atomikos with FuseESB, Blueprint, Hibernate and SQLServer. I try to insert a database record and then throw an exception, expecting a rollback. However the database record is stored immediately and no rollback happens.

I attach a log file with debug output.

Any ideas?

FuseESB version: 7.0.0.fuse-061
Atomikos version: 3.8.0
SQLServer sqljdbc4 version: 4.0


Datasource configuration:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
    xsi:schemaLocation="
      http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
      http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd">

     <!-- Configuration -->
    <cm:property-placeholder persistent-id="ch.suisa.licencing">
        <cm:default-properties>
            <cm:property name="database.driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
            <cm:property name="database.connection.url" value="jdbc:sqlserver://sqlentw.suisa.ch;instanceName=dublin;databaseName=spa;sendStringParametersAsUnicode=false;lockTimeout=60000" />
            <cm:property name="database.username" value="theDbUsername" />
            <cm:property name="database.password" value="theDbPassword" />
        </cm:default-properties>
    </cm:property-placeholder>

    <bean id="dataSourceBeanSuisa" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName" value="${database.driverClassName}" />
        <property name="url" value="${database.connection.url}" />
        <property name="username" value="${database.username}" />
        <property name="password" value="${database.password}" />
    </bean>

    <bean id="xaDataSourceBean" class="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean"
        init-method="init" destroy-method="close">
        <property name="uniqueResourceName" value="suisa_sql_server_xa_ds" />
        <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
        <property name="url" value="${database.connection.url}" />
        <property name="user" value="${database.username}" />
        <property name="password" value="${database.password}" />
        <property name="maxPoolSize" value="10"/>
    </bean>

    <service id="datasourceService" interface="javax.sql.DataSource"
        ref="dataSourceBeanSuisa">
        <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/suisaSQLDataSource"></entry>
        </service-properties>
    </service>

     <service id="xaDataSourceService" interface="javax.sql.DataSource"
        ref="xaDataSourceBean">
        <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/xaSuisaSQLDataSource" />
        </service-properties>
    </service>
</blueprint>

Persistence unit configuration:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

    <persistence-unit name="suisapue" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/xaSuisaSQLDataSource)</jta-data-source>
        <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/suisaSQLDataSource)</non-jta-data-source>

        <mapping-file>ch/suisa/common/base/entities/entity-mapping.xml</mapping-file>
        <mapping-file>ch/suisa/licencing/business/entities/entity-mapping.xml</mapping-file>

        <!-- Hibernate -->
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
            <property name="hibernate.show_sql" value="false"/>
            <property name="hibernate.format_sql" value="false"/>
            <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
            <!-- Custom lookup for transaction manager provided as an OSGi service -->
            <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.OsgiTransactionManagerLookup" />
        </properties>

    </persistence-unit>
</persistence>

All beans are configured with
        <tx:transaction method="*" value="Required" />

Thanks for any help.

Daniel
Daniel Zweifel Send private email
Wednesday, December 05, 2012
 
 
How can I attach my log file?
Daniel Zweifel Send private email
Wednesday, December 05, 2012
 
 
Ok, I found my problem myself.

I had two TransactionManager services running in my FuseESB and my TransactionManagerLookup just returned the first that it found which was not the Atomikos TransactionManager.
I changed my lookup and everything is working as expected.

Daniel
Daniel Zweifel Send private email
Thursday, December 06, 2012
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics