1 Reply Latest reply on Nov 29, 2006 11:16 AM by Dilshat Hewzulla

    Unique Constraint Error sending JMS Messages

    David Blakey Newbie

      Every couple of weeks I start getting this error message in my Java software and I have to restart the whole JBoss application.

      I am running 4.0.3 on Solaris 9. Has anyone seen this before or have any ideas on why it keeps happening. I checked the logs but there seems to be a gap from the 7th to the 10th Oct ???

      Thanks

      org.jboss.mq.SpyJMSException: Could not store message: 16948513 msg=67670 hard NOT_STORED PERSISTENT queue=TOPIC.DBEvent.ID:3763.-2147483648 priority=4 lateClone=false hashCode=3993794; - nested throwable: (java.sql.SQLException: Unique constraint violation: in statement [INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)])
      at org.jboss.mq.pm.jdbc2.PersistenceManager.saveToStorage(PersistenceManager.java:1349)
      at org.jboss.mq.server.MessageCache.saveToStorage(MessageCache.java:407)
      at org.jboss.mq.server.MessageReference.makeSoft(MessageReference.java:297)
      at org.jboss.mq.server.MessageCache.validateSoftReferenceDepth(MessageCache.java:354)
      at org.jboss.mq.server.MessageCache.addInternal(MessageCache.java:145)
      at org.jboss.mq.server.MessageCache.add(MessageCache.java:115)
      at org.jboss.mq.server.JMSTopic.addMessage(JMSTopic.java:393)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:397)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:373)
      at org.jboss.mq.server.JMSServerInterceptorSupport.addMessage(JMSServerInterceptorSupport.java:136)
      at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:153)
      at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:256)
      at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:136)
      at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:92)
      at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:369)
      at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: java.sql.SQLException: Unique constraint violation: in statement [INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)]
      at org.hsqldb.jdbc.Util.throwError(Unknown Source)
      at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:227)
      at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:904)
      at org.jboss.mq.pm.jdbc2.PersistenceManager.saveToStorage(PersistenceManager.java:1335)
      ... 17 more

        • 1. Re: Unique Constraint Error sending JMS Messages
          Dilshat Hewzulla Newbie

          We have got the same problem here after running the JBoss 4.0.5 for for several days.

          java.sql.SQLException: Unique constraint violation: in statement [INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)]


          Apparantly, the persistent manager is generating the same message ID (reference 3294537 msg=39626) until we have restarted the JBoss. I will be very grateful if you can tell me How the JMS message ID/reference is generated before persisting it into the database. I don't understand why all the JMS Messages to be persisted are stucked with the same ID.

          org.jboss.mq.SpyJMSException: Could not store message: 3294537 msg=39626 hard NOT_STORED NON_PERSISTENT queue=TOPIC.phoenix/FleetSchedulingServiceTopic.ID:3634.-2147483635 priority=1 lateClone=false hashCode=4627871; - nested throwable: (java.sql.SQLException: Unique constraint violation: in statement [INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)])
          org.jboss.mq.SpyJMSException: Could not store message: 3294537 msg=39626 hard NOT_STORED NON_PERSISTENT queue=TOPIC.phoenix/FleetSchedulingServiceTopic.ID:3634.-2147483635 priority=1 lateClone=false hashCode=4627871; - nested throwable: (java.sql.SQLException: Unique constraint violation: in statement [INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)])
           at org.jboss.mq.pm.jdbc2.PersistenceManager.saveToStorage(PersistenceManager.java:1646)
           at org.jboss.mq.server.MessageCache.saveToStorage(MessageCache.java:420)
           at org.jboss.mq.server.MessageReference.makeSoft(MessageReference.java:312)
           at org.jboss.mq.server.MessageCache.validateSoftReferenceDepth(MessageCache.java:367)
           at org.jboss.mq.server.MessageCache.addInternal(MessageCache.java:158)
           at org.jboss.mq.server.MessageCache.add(MessageCache.java:128)
           at org.jboss.mq.server.JMSTopic.addMessage(JMSTopic.java:416)
           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.jvm.JVMServerIL.addMessage(JVMServerIL.java:101)
           at org.jboss.mq.Connection.sendToServer(Connection.java:918)
           at org.jboss.mq.SpySession.sendMessage(SpySession.java:924)
           at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:272)
           at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:219)
           at org.jboss.mq.SpyTopicPublisher.publish(SpyTopicPublisher.java:67)
           at com.phoenix.booking.j2ee.beans.session.FleetSchedulingServiceSession.sendMessage(FleetSchedulingServiceSession.java:495)
           at com.phoenix.booking.j2ee.beans.session.FleetSchedulingServiceSession.updateFullSchedulerJob(FleetSchedulingServiceSession.java:300)
           at com.phoenix.booking.j2ee.beans.session.FleetSchedulingServiceBean.updateManyJobs(FleetSchedulingServiceBean.java:1846)
           at sun.reflect.GeneratedMethodAccessor958.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
           at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
           at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
           at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
           at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
           at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
           at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
           at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
           at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
           at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
           at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
           at org.jboss.ejb.Container.invoke(Container.java:954)
           at sun.reflect.GeneratedMethodAccessor283.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
           at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
           at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
           at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
           at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
           at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
           at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
           at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
           at $Proxy297.updateManyJobs(Unknown Source)
           at com.phoenix.booking.services.FleetSchedulingServiceImpl.updateManyJobs(FleetSchedulingServiceImpl.java:711)
           at com.phoenix.services.scheduler.SchedulingEngine.writeManyJobsToDatabase(SchedulingEngine.java:303)
           at com.phoenix.services.scheduler.SchedulingEngine.writeDirtyJobs(SchedulingEngine.java:274)
           at com.phoenix.services.scheduler.SchedulingEngine.run(SchedulingEngine.java:145)
           at java.lang.Thread.run(Thread.java:595)
          Caused by: java.sql.SQLException: Unique constraint violation: in statement [INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)]
           at org.hsqldb.jdbc.Util.throwError(Unknown Source)
           at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
           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.saveToStorage(PersistenceManager.java:1632)
           ... 58 more