activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dporob <>
Subject JMSException when using Virtual Destinations (ActiveMQ 5.0 with JBoss 5.0)
Date Fri, 25 Apr 2008 06:28:04 GMT

I Created a virtual topic 'refVirtualTopic' and two consumers for the topic
viz. 'Consumer.refVirtualQueue1.VirtualTopic.refVirtualTopic' and

I am using the JDBC Persistence Method and the Database used is PostgresQL
8.3. The activemq rar has been setup on JBoss. I created the topic and
queues using the following mbeans in activemq-jms-ds.xml and deployed it on
JBoss. :

   <mbean code="org.jboss.resource.deployment.AdminObject"
      <attribute name="JNDIName">jms/topic/refVirtualTopic</attribute>
      <attribute name="Type">javax.jms.Topic</attribute>

   <mbean code="org.jboss.resource.deployment.AdminObject"
      <attribute name="JNDIName">jms/queue/refVirtualQueue1</attribute>
      <attribute name="Type">javax.jms.Queue</attribute>

   <mbean code="org.jboss.resource.deployment.AdminObject"
      <attribute name="JNDIName">jms/queue/refVirtualQueue2</attribute>
      <attribute name="Type">javax.jms.Queue</attribute>

There is 1 Message Driven Bean listening on the first
consumer(refVirtualQueue1) and the another listening on the second one
(refVirtualQueue2). When I send a message on 'refVirtualTopic', only one of
the consumers' gets the message, the other one fails and I get the following
exception in publishMessage:
javax.jms.JMSException: Batch entry 0 INSERT INTO ACTIVEMQ_MSGS(ID,
ID:XX0703312495-3135-1209102883701-0:3:1:1, 1,
queue://Consumer.refVirtualQueue1.VirtualTopic.refVirtualTopic, 0, <stream
of 261 bytes>) was aborted.  Call getNextException to see the cause.

The problem seems to occur when activemq tries to insert an entry in the
'active_msgs' table with the same 'ID' (which is the primary key).

Is any configuration change required so that a unique msg id is generated
for each entry ?

I found 3 workarounds for the problem :
1. Change the delivery mode to non-persistent, msg not written to DB, so no
exception. But, I want it to be persistent to make sure the messages are not
2. Change the Persistence mode of activemq to AMQ message store (default
persistence mode). No DB used, so no primary key violation. But, I want to
use the JDBC method so that I can make use of the Master/Slave Configuration
for failover.
3. Change the constraint on the ACTIVE_MSGS table to (id, container). This
is just a workaround which might have some unknown side-effects. After this
change, both the beans get the message successfully. But then I tried the
same thing in a JBoss cluster. Deployed the publisher on node1 and the
consumers on node2. I stopped node2, sent the message on node1 and then
started node2. Only one of the consumers' got the message even though there
were 2 entries in the ACTIVE_MSGs table. I am not sure whether this is a
problem with JDBC persistence or with the change in the primary key of

Waiting for any responses,
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message