java 由于 KahaDB 被锁定,ActiveMQ 不会重新启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12770111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 10:08:37  来源:igfitidea点击:

ActiveMQ won't restart because KahaDB is locked

javajettyactivemqrestart

提问by IAmYourFaja

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

在我的开发机器上本地启动/停止 ActiveMQ (5.6) 我只是分别运行./activemq start./activemq stop

On our QA machine we have it installed as a service and run service activemq startand service activemq stoprespectively.

在我们的 QA 机器上,我们将它安装为服务service activemq startservice activemq stop分别运行和。

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

我只是去退回 QA 机器并发出service activemq stop,然后service activemq start重新启动它。

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

我看到正在创建一个进程 ID,如果我运行,ps -aef | grep activemq我会看到一个 ActiveMQ 服务器的活生生的、呼吸的过程。

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

但是,如果我去,http://<qa-server>:8161/admin我会收到服务器关闭时看到的典型错误:

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

Firefox 无法在 :8161 处建立到服务器的连接。

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

编辑:我现在已经尝试了./active startservice activemq start方法,并且都产生了相同的问题:我看到正在创建一个进程,但在 Web 管理工具中没有任何内容。

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.

我检查了 ActiveMQ 的主目录,但没有看到任何类型的logs/目录,所以我什至不确定从哪里开始调试问题。

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!

AMQ 没有重新启动,或者它的 Web 管理应用程序没有重新启动或正常运行;无论哪种方式,我都不知道从哪里开始。提前致谢!

Edit:

编辑

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

我看到以下错误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

2012-10-07 11:37:14,501 | 信息 | 数据库 /qa-server/kahadb/lock 已锁定...等待 10 秒以解锁数据库。原因:java.io.IOException:无法锁定文件“/qa-server/kahadb/lock”。| org.apache.activemq.store.kahadb.MessageDatabase | 主要 2012-10-07 11:37:24,504 | 信息 | 数据库 /qa-server/kahadb/lock 已锁定...等待 10 秒以解锁数据库。原因:java.io.IOException:无法锁定文件“/qa-server/kahadb/lock”。| org.apache.activemq.store.kahadb.MessageDatabase | 主要的

采纳答案by IAmYourFaja

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).

事实证明,我们的 QA 环境中有多个 AMQ 服务器。当我关闭第一台服务器时,由于某种原因抛出了一个异常,所以它没有释放锁。拥有该锁然后转到另一个 AMQ 实例(第一台服务器是主服务器,第二台服务器是从服务器)。

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.

当我尝试重新启动第一台服务器(主服务器)时,它不会重新启动,因为第二台服务器拥有锁。我关闭了第二台服务器并释放了锁,允许我重新启动它们。

回答by quartzde

Check the data/directory for logs.

检查data/日志目录。

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

这是一个错字吗?:8161.admin
尝试:8161/admin

回答by Sambit

  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"
  1. 转到您在 Win7 中的 apache 安装主文件夹,即 apache-activemq-X.XX.X
  2. 右键单击并选择属性
  3. 为您的登录用户更改此文件夹的访问权限 - “通常您的登录用户应该已经具有 ADMIN 访问权限,但是如果您在您的机器上解压缩了这个 apache MQ,那么管理员权限将丢失”

Now, you should have activemq command running smoothly

现在,您应该可以顺利运行 activemq 命令

回答by Bobby Fisher

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.

停止服务并不能保证服务已停止。Windows 跨线程,并且在一定时间后它假定服务已停止。如果您仍然看到它在进程列表中运行,请始终检查、验证、终止该进程。这样做可能会清除它持有的锁。

回答by ashu Kr

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
  1. 转到任务管理器并杀死当前运行的所有 java 进程。
  2. 以管理员身份运行 activemq 批处理文件

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

通过在本地浏览器中打开以下内容来验证它是否运行良好:http://localhost:8161/