JMS with Derby
palob Dec 21, 2004 8:45 AMI tried to use Derby DB 10.0.2.1 as store for JMS messages. Because it is not nativelly supported by JBoss 3.2.6 I am using (on Win 2000, JDK 1.5) I made my own jms services (after removing original hsqldb-jdbc2-service.xml and hsqldb-jdbc-state-service.xml).
My files follow (they are basicaly modified from existing examples):
derby-service.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- $Id: derby-service.xml,v 1.1.2.8 2004/08/20 09:52:22 ejort Exp $ --> <server> <!-- ==================================================================== --> <!-- Persistence and caching using HSQLDB --> <!-- See docs/examples/jms for other configurations --> <!-- ==================================================================== --> <!-- | The destination manager is the core service within JBossMQ --> <mbean code="org.jboss.mq.server.jmx.DestinationManager" name="jboss.mq:service=DestinationManager"> <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache</depends> <depends optional-attribute-name="PersistenceManager">jboss.mq:service=PersistenceManager</depends> <depends optional-attribute-name="StateManager">jboss.mq:service=StateManager</depends> </mbean> <!-- | The MessageCache decides where to put JBossMQ message that | are sitting around waiting to be consumed by a client. | | The memory marks are in Megabytes. Once the JVM memory usage hits | the high memory mark, the old messages in the cache will start getting | stored in the DataDirectory. As memory usage gets closer to the | Max memory mark, the amount of message kept in the memory cache aproaches 0. --> <mbean code="org.jboss.mq.server.MessageCache" name="jboss.mq:service=MessageCache"> <attribute name="HighMemoryMark">50</attribute> <attribute name="MaxMemoryMark">60</attribute> <attribute name="CacheStore">jboss.mq:service=PersistenceManager</attribute> </mbean> <!-- | The jdbc2 PersistenceManager is the new improved JDBC implementation. | This implementation allows you to control how messages are stored in | the database. | | Use this PM if you want the reliablity a relational database can offer | you. The default configuration is known to work with hsqldb, other | databases will requrie teaking of the SqlProperties e.g. changing table | colum definitions to database supported types. | | Take care that the selected blob column type in jms_messages can store | all message data. Some databases (e.g. mySQL) offer blob types with | different maximum capacity (e.g. mySQL-type BLOB=64K, LONGBLOB=2G). | | If you encouter problems with the configured BLOB_TYPE try a different | setting. Valid settings are OBJECT_BLOB, BINARYSTREAM_BLOB and BYTES_BLOB. --> <mbean code="org.jboss.mq.pm.jdbc2.PersistenceManager" name="jboss.mq:service=PersistenceManager"> <depends optional-attribute-name="ConnectionManager">jboss.jca:service=LocalTxCM,name=MyDS</depends> <attribute name="SqlProperties"> BLOB_TYPE=BYTES_BLOB INSERT_TX = INSERT INTO JMS_TRANSACTIONS (TXID) values(?) INSERT_MESSAGE = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?) SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS SELECT_MAX_TX = SELECT MAX(TXID) FROM JMS_MESSAGES SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=? SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=? MARK_MESSAGE = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE MESSAGEID=? AND DESTINATION=? UPDATE_MESSAGE = UPDATE JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=? UPDATE_MARKED_MESSAGES = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=? DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXOP=? AND JMS_MESSAGES.TXID IN (SELECT TXID FROM JMS_TRANSACTIONS) DELETE_TX = DELETE FROM JMS_TRANSACTIONS WHERE TXID = ? DELETE_MARKED_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? DELETE_TEMPORARY_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXOP='T' DELETE_MESSAGE = DELETE FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=? CREATE_MESSAGE_TABLE = CREATE TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, \ DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), \ MESSAGEBLOB BLOB, PRIMARY KEY (MESSAGEID, DESTINATION) ) CREATE_IDX_MSGS_TXOP_TXID = CREATE INDEX JMS_MESSAGES_TXOP_TXID ON JMS_MESSAGES (TXOP, TXID) CREATE_IDX_MSGS_DEST = CREATE INDEX JMS_MESSAGES_DESTINATION ON JMS_MESSAGES (DESTINATION) CREATE_TX_TABLE = CREATE TABLE JMS_TRANSACTIONS ( TXID INTEGER not null, PRIMARY KEY (TXID) ) CREATE_TABLES_ON_STARTUP = TRUE </attribute> </mbean> </server>
derby-state-service.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- $Id: hsqldb-jdbc-state-service.xml,v 1.1.2.2 2004/03/16 15:13:21 ejort Exp $ --> <server> <!-- ==================================================================== --> <!-- JBossMQ State Management using HSQLDB --> <!-- See docs/examples/jms for other configurations --> <!-- ==================================================================== --> <!-- A Statemanager that stores state in the database --> <mbean code="org.jboss.mq.sm.jdbc.JDBCStateManager" name="jboss.mq:service=StateManager"> <depends optional-attribute-name="ConnectionManager">jboss.jca:service=LocalTxCM,name=TapDS</depends> <attribute name="SqlProperties"> CREATE_TABLES_ON_STARTUP = TRUE CREATE_USER_TABLE = CREATE TABLE JMS_USERS (USERID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, \ CLIENTID VARCHAR(128), PRIMARY KEY(USERID)) CREATE_ROLE_TABLE = CREATE TABLE JMS_ROLES (ROLEID VARCHAR(32) NOT NULL, USERID VARCHAR(32) NOT NULL, \ PRIMARY KEY(USERID, ROLEID)) CREATE_SUBSCRIPTION_TABLE = CREATE TABLE JMS_SUBSCRIPTIONS (CLIENTID VARCHAR(128) NOT NULL, \ SUBNAME VARCHAR(128) NOT NULL, TOPIC VARCHAR(255) NOT NULL, \ SELECTOR VARCHAR(255), PRIMARY KEY(CLIENTID, SUBNAME)) GET_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=? LOCK_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=? GET_SUBSCRIPTIONS_FOR_TOPIC = SELECT CLIENTID, SUBNAME, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE TOPIC=? INSERT_SUBSCRIPTION = INSERT INTO JMS_SUBSCRIPTIONS (CLIENTID, SUBNAME, TOPIC, SELECTOR) VALUES(?,?,?,?) UPDATE_SUBSCRIPTION = UPDATE JMS_SUBSCRIPTIONS SET TOPIC=?, SELECTOR=? WHERE CLIENTID=? AND SUBNAME=? REMOVE_SUBSCRIPTION = DELETE FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=? GET_USER_BY_CLIENTID = SELECT USERID, PASSWD, CLIENTID FROM JMS_USERS WHERE CLIENTID=? GET_USER = SELECT PASSWD, CLIENTID FROM JMS_USERS WHERE USERID=? POPULATE.TABLES.01 = INSERT INTO JMS_USERS (USERID, PASSWD) VALUES ('guest', 'guest') POPULATE.TABLES.02 = INSERT INTO JMS_USERS (USERID, PASSWD) VALUES ('j2ee', 'j2ee') POPULATE.TABLES.03 = INSERT INTO JMS_USERS (USERID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample') POPULATE.TABLES.04 = INSERT INTO JMS_USERS (USERID, PASSWD) VALUES ('nobody', 'nobody') POPULATE.TABLES.05 = INSERT INTO JMS_USERS (USERID, PASSWD) VALUES ('dynsub', 'dynsub') POPULATE.TABLES.06 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('guest','guest') POPULATE.TABLES.07 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('j2ee','guest') POPULATE.TABLES.08 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('john','guest') POPULATE.TABLES.09 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('subscriber','john') POPULATE.TABLES.10 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('publisher','john') POPULATE.TABLES.11 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('publisher','dynsub') POPULATE.TABLES.12 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('durpublisher','john') POPULATE.TABLES.13 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('durpublisher','dynsub') POPULATE.TABLES.14 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('noacc','nobody') </attribute> </mbean> </server>
derbydb-ds.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- $Id: derbydb-ds.xml,v 1.1 2004/11/25 12:05:26 pbe Exp $ --> <datasources> <local-tx-datasource> <jndi-name>MyDS</jndi-name> <!-- <connection-url>jdbc:derby:derbydb</connection-url> <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class> <user-name>sa</user-name> <password>pass</password> </local-tx-datasource> </datasources>
My deployed application uses the same datasource through Hibernate 2.1.6. Its configuration follows:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.datasource">java:/MyDS</property> <property name="hibernate.connection.pool_size">100</property> <property name="hibernate.show_sql">false</property> <property name="hibernate.dialect">net.sf.hibernate.dialect.DerbyDialect</property> <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property> <property name="hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</property> <property name="jta.UserTransaction">UserTransaction</property> <!-- Mapping files --> <mapping resource="META-INF/obj1.hbm.xml"/> <mapping resource="META-INF/obj2.hbm.xml"/> </session-factory> </hibernate-configuration>
where Derby dialect was taken from http://opensource.atlassian.com/projects/hibernate/browse/HB-1224?page=all
Now, when application runs (messaging intensive, DB intensive), after around 17000 messages processed it causes deadlock and sometimes duplicate key exception. I should mention that during processing of messages, there are usually sent new messages, but not always, because it normally ends. Better - it is benchmark kind of application and some rounds were already finished and it works reliably on different setups (DB, ...). I suspect it is by my setup of Derby DB. What could be a problem? Can somebody help me to point me to the place made a mistake or where it might be probably located?
Thank you very much.
Pavol
And yes, here is stacktrace.
2004-12-20 18:00:30,677 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=sonic//85768, BranchQual=] errorCode=XAER_RMERR org.jboss.mq.SpyXAException: - nested throwable: (org.jboss.mq.SpyJMSException: Could not commit tx: 21746; - nested throwable: (SQL Exception: A lock could not be obtained due to a deadlock, cycle of locks & waiters is: Lock : ROW, JMS_MESSAGES, (33,1) Waiting XID : {23506287, S} , SA, DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? Granted XID : {23506292, S} Lock : ROW, JMS_MESSAGES, (152,1035) Waiting XID : {23506292, U} , SA, DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? Granted XID : {23506287, U} The selected victim is XID : 23506287)) at org.jboss.mq.SpyXAResource.commit(SpyXAResource.java:88) at org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1656) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:396) at org.jboss.tm.TxManager.commit(TxManager.java:142) at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:361) at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:877) at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159) at org.jboss.mq.SpySession.run(SpySession.java:351) at org.jboss.jms.asf.StdServerSession.run0(StdServerSession.java:200) at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748) at java.lang.Thread.run(Thread.java:595) Caused by: org.jboss.mq.SpyJMSException: Could not commit tx: 21746; - nested throwable: (SQL Exception: A lock could not be obtained due to a deadlock, cycle of locks & waiters is: Lock : ROW, JMS_MESSAGES, (33,1) Waiting XID : {23506287, S} , SA, DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? Granted XID : {23506292, S} Lock : ROW, JMS_MESSAGES, (152,1035) Waiting XID : {23506292, U} , SA, DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? Granted XID : {23506287, U} The selected victim is XID : 23506287) at org.jboss.mq.pm.jdbc2.PersistenceManager.commitPersistentTx(PersistenceManager.java:581) at org.jboss.mq.pm.Tx.commit(Tx.java:174) at org.jboss.mq.pm.TxManager.commitTx(TxManager.java:89) at org.jboss.mq.server.JMSDestinationManager.transact(JMSDestinationManager.java:504) at org.jboss.mq.server.JMSServerInterceptorSupport.transact(JMSServerInterceptorSupport.java:186) at org.jboss.mq.security.ServerSecurityInterceptor.transact(ServerSecurityInterceptor.java:182) at org.jboss.mq.server.TracingInterceptor.transact(TracingInterceptor.java:438) at org.jboss.mq.server.JMSServerInvoker.transact(JMSServerInvoker.java:186) at org.jboss.mq.il.jvm.JVMServerIL.transact(JVMServerIL.java:327) at org.jboss.mq.Connection.send(Connection.java:1213) at org.jboss.mq.SpyXAResourceManager.commit(SpyXAResourceManager.java:159) at org.jboss.mq.SpyXAResource.commit(SpyXAResource.java:84) ... 11 more Caused by: SQL Exception: A lock could not be obtained due to a deadlock, cycle of locks & waiters is: Lock : ROW, JMS_MESSAGES, (33,1) Waiting XID : {23506287, S} , SA, DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? Granted XID : {23506292, S} Lock : ROW, JMS_MESSAGES, (152,1035) Waiting XID : {23506292, U} , SA, DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? Granted XID : {23506287, U} The selected victim is XID : 23506287 at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java) at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335) at org.jboss.mq.pm.jdbc2.PersistenceManager.removeMarkedMessages(PersistenceManager.java:608) at org.jboss.mq.pm.jdbc2.PersistenceManager.commitPersistentTx(PersistenceManager.java:574) ... 22 more 2004-12-20 18:00:32,224 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=sonic//86041, BranchQual=] errorCode=XAER_RMERR org.jboss.mq.SpyXAException: - nested throwable: (org.jboss.mq.SpyTransactionRolledBackException: Transaction was rolled back.; - nested throwable: (org.jboss.mq.SpyJMSException: Could not create tx: 21850; - nested throwable: (SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'.))) at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:135) at org.jboss.tm.TransactionImpl.prepareResources(TransactionImpl.java:1556) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:385) at org.jboss.tm.TxManager.commit(TxManager.java:142) at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:361) at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:877) at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159) at org.jboss.mq.SpySession.run(SpySession.java:351) at org.jboss.jms.asf.StdServerSession.run0(StdServerSession.java:200) at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748) at java.lang.Thread.run(Thread.java:595) Caused by: org.jboss.mq.SpyTransactionRolledBackException: Transaction was rolled back.; - nested throwable: (org.jboss.mq.SpyJMSException: Could not create tx: 21850; - nested throwable: (SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'.)) at org.jboss.mq.server.JMSDestinationManager.transact(JMSDestinationManager.java:490) at org.jboss.mq.server.JMSServerInterceptorSupport.transact(JMSServerInterceptorSupport.java:186) at org.jboss.mq.security.ServerSecurityInterceptor.transact(ServerSecurityInterceptor.java:182) at org.jboss.mq.server.TracingInterceptor.transact(TracingInterceptor.java:438) at org.jboss.mq.server.JMSServerInvoker.transact(JMSServerInvoker.java:186) at org.jboss.mq.il.jvm.JVMServerIL.transact(JVMServerIL.java:327) at org.jboss.mq.Connection.send(Connection.java:1213) at org.jboss.mq.SpyXAResourceManager.prepare(SpyXAResourceManager.java:208) at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:131) ... 11 more Caused by: org.jboss.mq.SpyJMSException: Could not create tx: 21850; - nested throwable: (SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'.) at org.jboss.mq.pm.jdbc2.PersistenceManager.insertPersistentTx(PersistenceManager.java:743) at org.jboss.mq.pm.jdbc2.PersistenceManager.remove(PersistenceManager.java:1026) at org.jboss.mq.server.BasicQueue.acknowledge(BasicQueue.java:536) at org.jboss.mq.server.JMSQueue.acknowledge(JMSQueue.java:123) at org.jboss.mq.server.ClientConsumer.acknowledge(ClientConsumer.java:328) at org.jboss.mq.server.JMSDestinationManager.acknowledge(JMSDestinationManager.java:536) at org.jboss.mq.server.JMSDestinationManager.transact(JMSDestinationManager.java:481) ... 19 more Caused by: SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'. at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java) at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335) at org.jboss.mq.pm.jdbc2.PersistenceManager.addTXRecord(PersistenceManager.java:629) at org.jboss.mq.pm.jdbc2.PersistenceManager.insertPersistentTx(PersistenceManager.java:738) ... 25 more 2004-12-20 18:00:32,224 ERROR [org.jboss.jms.asf.StdServerSession] failed to commit/rollback org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=sonic//86041, BranchQual=] status=STATUS_NO_TRANSACTION; - nested throwable: (org.jboss.mq.SpyXAException: - nested throwable: (org.jboss.mq.SpyTransactionRolledBackException: Transaction was rolled back.; - nested throwable: (org.jboss.mq.SpyJMSException: Could not create tx: 21850; - nested throwable: (SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'.)))) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:415) at org.jboss.tm.TxManager.commit(TxManager.java:142) at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:361) at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:877) at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159) at org.jboss.mq.SpySession.run(SpySession.java:351) at org.jboss.jms.asf.StdServerSession.run0(StdServerSession.java:200) at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748) at java.lang.Thread.run(Thread.java:595) Caused by: org.jboss.mq.SpyXAException: - nested throwable: (org.jboss.mq.SpyTransactionRolledBackException: Transaction was rolled back.; - nested throwable: (org.jboss.mq.SpyJMSException: Could not create tx: 21850; - nested throwable: (SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'.))) at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:135) at org.jboss.tm.TransactionImpl.prepareResources(TransactionImpl.java:1556) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:385) ... 9 more Caused by: org.jboss.mq.SpyTransactionRolledBackException: Transaction was rolled back.; - nested throwable: (org.jboss.mq.SpyJMSException: Could not create tx: 21850; - nested throwable: (SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'.)) at org.jboss.mq.server.JMSDestinationManager.transact(JMSDestinationManager.java:490) at org.jboss.mq.server.JMSServerInterceptorSupport.transact(JMSServerInterceptorSupport.java:186) at org.jboss.mq.security.ServerSecurityInterceptor.transact(ServerSecurityInterceptor.java:182) at org.jboss.mq.server.TracingInterceptor.transact(TracingInterceptor.java:438) at org.jboss.mq.server.JMSServerInvoker.transact(JMSServerInvoker.java:186) at org.jboss.mq.il.jvm.JVMServerIL.transact(JVMServerIL.java:327) at org.jboss.mq.Connection.send(Connection.java:1213) at org.jboss.mq.SpyXAResourceManager.prepare(SpyXAResourceManager.java:208) at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:131) ... 11 more Caused by: org.jboss.mq.SpyJMSException: Could not create tx: 21850; - nested throwable: (SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'.) at org.jboss.mq.pm.jdbc2.PersistenceManager.insertPersistentTx(PersistenceManager.java:743) at org.jboss.mq.pm.jdbc2.PersistenceManager.remove(PersistenceManager.java:1026) at org.jboss.mq.server.BasicQueue.acknowledge(BasicQueue.java:536) at org.jboss.mq.server.JMSQueue.acknowledge(JMSQueue.java:123) at org.jboss.mq.server.ClientConsumer.acknowledge(ClientConsumer.java:328) at org.jboss.mq.server.JMSDestinationManager.acknowledge(JMSDestinationManager.java:536) at org.jboss.mq.server.JMSDestinationManager.transact(JMSDestinationManager.java:481) ... 19 more Caused by: SQL Exception: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL041217064028740' defined on 'JMS_TRANSACTIONS'. at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java) at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335) at org.jboss.mq.pm.jdbc2.PersistenceManager.addTXRecord(PersistenceManager.java:629) at org.jboss.mq.pm.jdbc2.PersistenceManager.insertPersistentTx(PersistenceManager.java:738) ... 25 more