-->

Failed to configure custom ActiveMQ broker in TomE

2019-08-04 18:41发布

问题:

Until now I used the default ActiveMQ configuration in TomEE. Now I would like to turn on scheduler support, so I added these things to tomee.xml:

<Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
    BrokerXmlConfig = broker:(tcp://127.0.0.1:61616)?usekahadb=true&amp;persistent=true&amp;schedulerSupport=true
</Resource>

<Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">
    ResourceAdapter = MyJmsResourceAdapter
</Resource>

But I get these error messages:

Database activemq-data/localhost/scheduler/lock is locked... waiting 10 seconds for the database to be unlocked. Reason: java.io.IOException: Failed to create directory 'activemq-data/localhost/scheduler'

Can anyone help me what to do? Every documentation that I found about configuring ActiveMQ inside TomEE is sadly poor, and I cannot figure out how to turn on scheduler support inside TomEE.

回答1:

The problem was that the base directory for ActiveMQ inside TomEE is the TomEE's bin folder and it was not writeable by TomEE so TomEE could not create folders for KahaDB. Making bin writeable for tomee process solved the problem.

After ActiveMQ created necessary folders, I have changed permissions on bin folder back to the original state (for security reason).