0

I plan to use delays in activemq and I was referring to some posts like this where people have mentioned about the following change in activemq.xml to enable the scheduler :

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" schedulerSupport="true">

So, I did the exact same thing in my activemq.xml and it's resulting in the following:

C:\tan\my_softwares\apache-activemq-5.15.11\bin>activemq start
Java Runtime: Oracle Corporation 13.0.2 C:\Program Files\Java\jdk-13.0.2
  Heap sizes: current=1048576k  free=1042942k  max=1048576k
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf\login.config -Dactivemq.classpath=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf;C:\tan\my_softwares\apache-activemq-5.15.11\bin\../conf;C:\tan\my_softwares\apache-activemq-5.15.11\bin\../conf; -Dactivemq.home=C:\tan\my_softwares\apache-activemq-5.15.11\bin\.. -Dactivemq.base=C:\tan\my_softwares\apache-activemq-5.15.11\bin\.. -Dactivemq.conf=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf -Dactivemq.data=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data -Djava.io.tmpdir=C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data\tmp
Extensions classpath:
  [C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\camel,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\optional,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\web,C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\lib\extra]
ACTIVEMQ_HOME: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..
ACTIVEMQ_BASE: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..
ACTIVEMQ_CONF: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\conf
ACTIVEMQ_DATA: C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@1cbbffcd: startup date [Thu Jun 25 07:35:22 CDT 2020]; root of context hierarchy
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data\kahadb]
 INFO | KahaDB is version 6
 INFO | PListStore:[C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data \localhost\tmp_storage] started
 INFO | Database C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data \localhost\scheduler\lock is locked by another server. This broker is now in slave mode waiting a lock to be acquired

After this, I am not able to access the web console of ActiveMQ and http://localhost:8161/admin/index.jsp results in Unable to connect. However, if I put back the original configuration back, which is without schedulerSupport, everything works fine and I am able to access the web console :

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">

How to fix this issue?

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
Tan
  • 1,433
  • 5
  • 27
  • 47

1 Answers1

0

The scheduler uses its own custom KahaDB store to manage scheduled messages and the folder that it is using seems to have a lock on the file it uses to ensure that only one instance of the broker writes into that store. You would need to investigate if there is another broker instance accessing that store location and either stop it or update the configuration to use a different location. Also you might check folder permissions etc. You could also manually delete all files in that folder to ensure the old lock file is removed.

Namely the directory that the logs are explicitly pointing out as being the problem.

INFO | Database C:\tan\my_softwares\apache-activemq-5.15.11\bin\..\data \localhost\scheduler\lock is locked by another server. This broker is now in slave mode waiting a lock to be acquired
Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • Thanks. 1) There is only one activemq instnce that I am trying to run locally so I wonder how could an another broker instance interfere.2) ` You could also manually delete all files in that folder to ensure the old lock file is removed.` Which folder you are referring here? – Tan Jun 25 '20 at 17:11
  • Edited the answer to paste the log you already pasted but didn't read I guess.... – Tim Bish Jun 25 '20 at 19:49
  • Thanks. I deleted everything inside the `kahadb` folder first and also tried deleting `lock` file only and then I restarted the activemq. It still shows same issue. Please let me know if there's any other way I could troubleshoot this. If you need an `activemq.xml` file, I can paste it in my original post. – Tan Jun 25 '20 at 23:33
  • Sounds like a permission issue. Try running in a linux VM instead of using Windows. Or perhaps try removing any whitespace from the install directories on Windows – Tim Bish Jun 26 '20 at 15:52
  • Ok, I will test this on RHEL server where I have activemq installed. – Tan Jun 26 '20 at 15:59
  • So I ran it on RHEL server and it didn't complain. How do I know in the UI that it has started? 1) The scheduled section still shows it hasn't started as shown here : https://i.stack.imgur.com/7pusV.png and 2) I updated the broker name in the URL `` from `localhost` to something else, the web console is not showing that for some reason. However, it did show in the command line when I stopped the activemq. – Tan Jun 28 '20 at 00:21