Phillip McCarley created AMQ-3870:
-------------------------------------

             Summary: ArrayIndexOutOfBoundsException when using Multi kahaDB 
(mKahaDB) adapter, per-destination adapters and Topics
                 Key: AMQ-3870
                 URL: https://issues.apache.org/jira/browse/AMQ-3870
             Project: ActiveMQ
          Issue Type: Bug
          Components: Message Store
    Affects Versions: 5.6.0
         Environment: Java v1.6.0_21
Windows XP SP3
            Reporter: Phillip McCarley


Steps to reproduce the issue:

- Unpack clean "apache-activemq-5.6.0-bin.zip" to local drive.
- Change the default configuration to use the mKahaDB adapter and 
per-destination instances (exactly as given at 
http://activemq.apache.org/kahadb.html in the very last config snippet). See 
also attached activemq.xml
- Start up ActiveMQ from bin/activemq.bat
- Run a small test program that simply creates a Topic and attempts to consume 
(that main point here is that the Topic is created and due to "per-destination" 
mKahaDB, a folder is created in the data directory specifically for this Topic.
- Shutdown ActiveMQ normally.
- Restart ActiveMQ normally, and the ArrayIndexOutOfBoundsException will be 
thrown. (see attached activemq.log)


I have done some investigation and it seems that on restart when it is 
attempting to "registerExistingAdapter", it wants to register each adapter with 
one of the destinations (the first in fact) that each adapter applies to 
(adapter.getDestinations()...[0]). However, in getDestinations(), empty topics 
get filtered out of the return value, and since we are using 
per-destination="true" there can be adapters for topics only and so a chance 
that getDestinations() returns an empty List. Hence causing the Exception when 
trying to access the first destination from that list.


The reason that I haven't gone further, to supply a patch, is that I am unsure 
of what would be an appropriate way to register these adapters, or if you could 
leave them and not register them anyway, since they are empty topics.

Note, that if you extend the configuration of the mKahaDB adapter to provide an 
explicit adapter for all topics, then the issue goes away. (see commented part 
of mKahaDB config in activemq.xml attached)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to