Hi all,

I'm new to XA transactions and I'm trying to test them with Tomee + ActiveMQ
and Derby.

However, it seems like Derby won't enlist in a XA Transaction, I keep
getting the following error :

org.apache.derby.client.am.XaException: XAER_DUPID : Error executing a
XAResource.start(), server returned XAER_DUPID.

I did some research but it doesn't seems like Derby is frequently used with
XA Transactions.

Can anyone point me to what might be wrong in my configuration ?
Here is my tomee.xml :

<?xml version="1.0" encoding="UTF-8"?>
<tomee>

    <Resource id="JmsResourceAdapter" type="ActiveMQResourceAdapter">
        # Do not start the embedded ActiveMQ broker
        BrokerXmlConfig  =
        ServerUrl = tcp://localhost:61616
    </Resource>

    <Container id="JmsMdbContainer" type="MESSAGE">
        ResourceAdapter = JmsResourceAdapter
    </Container>

        <Resource id="derbyDataSource" type="DataSource">
            JdbcDriver = org.apache.derby.jdbc.ClientXADataSource
            JdbcUrl = jdbc:derby://localhost:1527/MyDbTest
            JtaManaged = true
            databaseName = MyDbTest
            UserName = admin
                Password = pass
        </Resource>

</tomee>


And here is my simple MDB:

@MessageDriven(
                activationConfig = { 
                                @ActivationConfigProperty(propertyName = 
"destinationType",
propertyValue = "javax.jms.Queue"), 
                                @ActivationConfigProperty(propertyName = 
"destination", propertyValue =
"test")
                })
public class MaxgwMDB implements MessageListener {

    @Resource(name="derbyDataSource")
    private DataSource dataSource;
        
    
    /*
     * (non-Javadoc)
     * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
     */
    public void onMessage(Message message) {
        
        PreparedStatement pstm = null;
        Connection conn = null;
        
        try {
                conn = dataSource.getConnection();
                pstm = conn.prepareStatement("insert into persons values(?)");
        } catch (SQLException e) {      
            ... 
        } finally {
            ...
        }
    }

}


Thanks for any help!

Alex



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Derby-XA-Transactions-tp4673002.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to