[jboss-user] Jboss-mq: Duplicate message ID error when messages are persisted
Koya, Suresh (Suresh Koya)
suresh.koya at hp.com
Fri Nov 12 19:09:29 EST 2010
Hi,
I are using Jboss 4.0.5 GA as the application server and wanted to see if someone can provide some insight into how messages ID's are generated in a cluster. I am seeing issues when Jboss MQ server is configured in a cluster where messages are persisted in Oracle. Duplicate message id's are getting generated in the nodes in a cluster when this happens. The messages aren't persisted at this point and fail with the following error.
Caused by: org.jboss.mq.SpyJMSException: Could not store message: 3 msg=87 hard NOT_STORED PERSISTENT queue=QUEUE.ppmLightServiceQueue priority=4 lateClone=false hashCode=1363363; - nested throwable: (java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (ITG.SYS_C007015) violated)
at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:1097)
at org.jboss.mq.server.PersistentQueue.addMessage(PersistentQueue.java:58)
at org.jboss.mq.server.JMSQueue.addMessage(JMSQueue.java:180)
at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:415)
at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:399)
at org.jboss.mq.server.JMSServerInterceptorSupport.addMessage(JMSServerInterceptorSupport.java:106)
at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:168)
at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:226)
at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:112)
at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:111)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:395)
at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (ITG.SYS_C007015) violated
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:85)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:947)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3462)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1349)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:1136)
at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:1082)
... 13 more
Is there a configuration parameter that can be changed to avoid duplicate messages being generated in a cluster.
In Conclusion:
Since the JMS publisher is an HA Singleton, it may switch node from time to time. The zero start value is hardcoded in the JBoss 4.0.5GA messaging code, in org.jboss.mq.server.JMSDestination:
//Counter used to number incomming messages. (Used to order the messages.)
long nextMessageIdCounter = 0;
protected long nextMessageId() {
<snip>
}
So the way to fix this is to modify org.jboss.mq.server.JMSDestination.nextMessageId() to return a message id generated from the current system clock. Can someone suggest if this is the right approach for this problem. I see that this is something basic which a HA application should cater to that I need to understand. Can someone shed some light into this?
Regards,
Suresh
More information about the jboss-user
mailing list