IAmYourFaja
IAmYourFaja

Reputation: 56912

ActiveMQ won't restart because KahaDB is locked

Locally to start/stop ActiveMQ (5.6) on my dev machine I just run ./activemq start and ./activemq stop respectively.

On our QA machine we have it installed as a service and run service activemq start and service activemq stop respectively.

I just went to bounce the QA machine and issued service activemq stop, then service activemq start to restart it.

I see a process ID being created, and if I run ps -aef | grep activemq I see the living, breathing process of an ActiveMQ server.

But if I go to http://<qa-server>:8161/admin I get the typical error that you see when a server is down:

Firefox can't establish a connection to the server at :8161.

Edit: I have now tried both the ./active start and service activemq start methods, and both produce the same issue: I see a process being created, but nothing in the web admin tool.

I checked ActiveMQ's home directory and don't see any type of logs/ directory, so I'm not even sure where to begin debugging the issue.

Either AMQ is not restarting, or its web admin app isn't restarting or functioning properly; either way I have no idea where to start. Thanks in advance!

Edit:

I see the following error in data/activemq.log:

2012-10-07 11:37:14,501 | INFO | Database /qa-server/kahadb/lock is locked... waiting 10 seconds for the database to be unlocked. Reason: java.io.IOException: File '/qa-server/kahadb/lock' could not be locked. | org.apache.activemq.store.kahadb.MessageDatabase | main 2012-10-07 11:37:24,504 | INFO | Database /qa-server/kahadb/lock is locked... waiting 10 seconds for the database to be unlocked. Reason: java.io.IOException: File '/qa-server/kahadb/lock' could not be locked. | org.apache.activemq.store.kahadb.MessageDatabase | main

Upvotes: 7

Views: 18409

Answers (5)

Sambit
Sambit

Reputation: 11

  1. Go to your apache installation home folder in Win7 i.e. apache-activemq-X.XX.X
  2. Right click and select properties
  3. Change the access permission of this folder for your logged in user - "normally your logged in user should already have ADMIN access, but if you have this apache MQ unzipped on your machine, then admin permission would be missing"

Now, you should have activemq command running smoothly

Upvotes: 1

Ashutosh Kumar
Ashutosh Kumar

Reputation: 321

If non of the above are working for your case, please follow below simpler steps:

  1. Go to task-manager and kill all the java process running currently.
  2. Run the activemq batch file as Administrator

Verify this is running fine by opening the below in your local browser: http://localhost:8161/

Upvotes: 0

IAmYourFaja
IAmYourFaja

Reputation: 56912

Turns out there were multiple AMQ servers in our QA environment. When I shutdown the first server, an exception was thrown for some reason and so it didn't release the lock. Possession of that lock then went to the other AMQ instance (the first server was the master, the 2nd server was the slave).

When I tried restarting the first server (the master), it wouldn't restart because the 2nd server had possession of the lock. I shutdown the 2nd server and the lock was released, allowing me to restart them both.

Upvotes: 5

Bobby Fisher
Bobby Fisher

Reputation: 92

Stopping a service does not guarantee you that the service is stopped. Windows spans threads and after a certain amount of time it assumes that the service is stopped. Always check, verify, kill the process if you still see it running in the processes list. Doing that may clear the locks it is holding.

Upvotes: 0

quartzde
quartzde

Reputation: 638

Check the data/ directory for logs.

And is this a typo? :8161.admin
Try :8161/admin

Upvotes: 2

Related Questions