9 Replies Latest reply on Mar 9, 2011 5:43 PM by kiran sahoo

    JMS Persistence Manager Exception

    sys user Master

      Hi,
      I am getting this exception when sending a message to the queue.
      This happens occasionally.
      looks like two messages of the queue are creating the same message id and trying to persist in the JMS_MESSAGES table which has message_id and queue name as the Primary key.

      How is the message id generated?
      Is it a hashcode generated from the message?


      org.jboss.mq.SpyJMSException: Could not store message: 107056 msg=5326 hard NOT_STORED PERSISTENT queue=QUEUE.MyTestQueue priority=4 hashCode=3613670; - nested throwable: (java.sql.SQLException: ORA-00001: unique constraint (PK_JMSMESSAGE) violated
      )



      Thanks
      Kal

        • 1. Re: JMS Persistence Manager Exception
          Adrian Brock Master

          More likely is that you are sharing your JMS_MESSAGES table with
          another jboss instance.

          Regards,
          Adrian

          • 2. Re: JMS Persistence Manager Exception
            sys user Master

            yes that's true.

            Thanks

            • 3. Re: JMS Persistence Manager Exception
              sys user Master

              there are 3 identical Jboss instances on 3 servers pointing to the same database. These 3 are like a cluster but NOT a Jboss cluster though. and the application is deployed on all 3 instances.
              so clients write to these queues pointing to the same database.
              do I have to create separate Persistence Managers with different table names (JMS_MESSAGES_1, JMS_MESSAGES_2, JMS_MESSAGES_3 etc...)

              Thanks
              Kal

              • 4. Re: JMS Persistence Manager Exception
                Adrian Brock Master

                Yes. You might want to simplify it by making use of system properties to access
                something unique like your user id. Making it easier to share configurations.

                e.g. JMS_MESSAGES_$[user.name]
                

                except replace [ with {

                Regards,
                Adrian

                • 5. Re: JMS Persistence Manager Exception
                  Subhash Uppalapati Newbie

                  Hi Adrian,
                  I ran into the same situation where I have load balancer environment and both instances are trying to create entry into JMS_MESSAGES table with the same primary key. The exception that I am getting is :

                  org.jboss.mq.SpyJMSException: Could not store message: 4276 msg=4275 hard NOT_STORED PERSISTENT queue=QUEUE.DLQ priority=4 lateClone=false hashCode=10168191; - nested throwable: (com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '4275-QUEUE.DLQ' for key 'PRIMARY')
                  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '4275-QUEUE.DLQ' for key 'PRIMARY'
                   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
                   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)


                  I am using JBoss 4.2.3 and MySql to store JMS messages. I could not understand about creating multiple persistence managers. I am also wondering as this is a thread of 5 years old, you might have come across a better solution.
                  Please let me know.

                  Thanks,
                  Subhash


                  • 6. Re: JMS Persistence Manager Exception
                    Adrian Brock Master

                    Its only multiple persistence managers in that there are multiple jboss servers sharing the same database (and trying to write over each other's data).

                    The example I gave was different users, but it could equally be a test and production environment.

                    So you could have the test environment use JMS_MESSAGES_TEST as the name
                    so it doesn't interfere with the normal JMS_MESSAGES table (and the same for the
                    transactions).

                    • 7. Re: JMS Persistence Manager Exception
                      Subhash Uppalapati Newbie

                      Hi,
                      Thank you for your reply. What I understand to do is to edit the mysql-jdbc2-service file to reflect the correct JMS Messages and transactions table.

                      In my case, I have two instances of JBoss running in the same environment and pointing to the same DB.
                      What is the solution in this kind of situation?

                      • 8. Re: JMS Persistence Manager Exception
                        Bernd Eckenfels Novice

                        You need to deploy the JMS Provider as a HA-Singleton in a real jboss cluster or deploy 3 JMS PRoviders with different tables.

                        You cannot have more than one persitence manager access the same table (not with JBossMQ).

                        • 9. Re: JMS Persistence Manager Exception
                          kiran sahoo Newbie

                          hello, I am facing the same issue and I have deployed it as HA-singleton.Any help would be greatly appreciated