Activemq无法在我的Ubuntu虚拟机上启动

12

我试图在我的Ubuntu虚拟机上运行ActiveMQ,但始终无法启动。我尝试了下载二进制文件和源代码,但都失败了。目前,我已经下载了源代码,并运行了"mvn clean install -Dmaven.test.skip=true"命令,Maven报告安装成功。然后我在.m2文件夹中搜索到apache-activemq-5.5.1-bin.tar.gz文件并将其解压到我的home/USERNAME目录下,尝试运行"bash bin/activemq start",但却收到以下错误信息。

INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties
 and log4j.properties     
to get details
bin/activemq: line 370: /usr/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true
 -Djava.util.logging.config.file=logging.properties
 -Dcom.sun.management.jmxremote
 -Dactivemq.classpath="/home/jacob/activeMq1/apache-activemq-5.5.1/conf;"
 -Dactivemq.home="/home/jacob/activeMq1/apache-activemq-5.5.1"  
-Dactivemq.base="/home/jacob/activeMq1/apache-activemq-5.5.1"
-jar "/home/jacob/activeMq1/apache-activemq-5.5.1/bin/run.jar" start >/dev/null 2>&1 & 
 RET="$?"; APID="$!";
 echo $APID > /home/jacob/activeMq1/apache-activemq-5.5.1/data/activemq.pid;
 echo "INFO: pidfile created : '/home/jacob/activeMq1/apache-activemq-5.5.1/data/activemq.pid' (pid '$APID')";
 exit $RET: No such file or directory    

有人遇到过这种类型的错误吗?


我在这方面做了更多的工作。我能够从bin文件运行“java -jar run.jar start”。虽然我相当确定仅运行run.jar不是最佳实践。 - OrwellHindenberg
4个回答

18

看起来我又要回答自己的问题了,但也许这会帮助未来的某个人。

步骤:

  1. 运行命令"./bin/activemq setup newConfig"(不包括引号),创建一个配置文件,从而使activemq正常工作。
  2. 然后将位于etc/default/下的当前配置文件"activemq"替换为新的配置文件"newConfig"。(在覆盖原始activemq文件之前,先备份一下它)。
  3. 运行"./bin/activemq start",这将创建一个PID文件。
  4. 在文件被创建后,重新运行"./bin/activemq start"来最终启动代理程序。

接下来,您可以通过导航到"http://localhost:8161/admin/"或执行"netstat -an | grep 61616"(如果保留了默认端口等)来测试安装情况。


3
当我尝试使用适用于Ubuntu 12.04的Ubuntu软件包时,我遇到了与你相同的错误,而且这些步骤并没有解决它。然而,当我使用tar.gz版本时,你的步骤完美地解决了这个错误。 - Thomas
谢谢!我也使用了您的步骤在Ubuntu 13.10上安装ActiveMQ 5.8。 - Drew Wills
谢谢,这很有帮助。我们正在使用Bash脚本自动下载和安装Activemq以及可用的服务,但是无论我们的脚本有多完美,当我们尝试在新创建的实例上执行vagrant up并运行脚本时,activemq都不会启动,直到我们手动输入命令。感谢这篇文章,让我们意识到了原因。 - Venu Murthy

13

我在Debian上安装了activemq 5.13,在/opt目录下下载并解压缩,然后进入/opt/apache-activemq-5.13.1/run执行"./bin/activemq start",然后出现了以下错误:

xx@debian:/opt/apache-activemq-5.13.1$ ./bin/activemq start
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
./bin/activemq: 330: ./bin/activemq: "/usr/bin/java"  -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq-5.13.1//conf/login.config   -Djava.awt.headless=true -Djava.io.tmpdir="/opt/apache-activemq-5.13.1//tmp"                -Dactivemq.classpath="/opt/apache-activemq-5.13.1//conf:/opt/apache-activemq-5.13.1//../lib/:"               -Dactivemq.home="/opt/apache-activemq-5.13.1/"               -Dactivemq.base="/opt/apache-activemq-5.13.1/"               -Dactivemq.conf="/opt/apache-activemq-5.13.1//conf"               -Dactivemq.data="/opt/apache-activemq-5.13.1//data"                              -jar "/opt/apache-activemq-5.13.1//bin/activemq.jar" start >/dev/null 2>&1 &
          RET="$?"; APID="$!";
          echo $APID > /opt/apache-activemq-5.13.1//data/activemq.pid;
          echo "INFO: pidfile created : '/opt/apache-activemq-5.13.1//data/activemq.pid' (pid '$APID')";exit $RET: not found

我所做的是使用 "uname -a" 命令来检查 Debian 版本:

Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux
我发现我的Debian是64位系统,因此我执行:
./bin/linux-x86-64/activemq start

它显示:

Starting ActiveMQ Broker...

然后我可以使用用户名 "admin" 和密码 "admin" 访问网站:http://localhost:8161/admin/


谢谢。它帮助了我。 - DIBits

9
在Ubuntu 14.04中,我需要在 /etc/activemq/instances-enabled 中创建一个链接。
sudo ln -s ../instances-available/main/

类似于apache2的设置

然后使用/etc/init.d/activemq start启动服务器


在Ubuntu 18.04中,使用以下命令可以运行: sudo /etc/init.d/activemq start - Syed Abdul Kather

4

需要使用sudo。

bin$ sudo ./activemq start

bin$ sudo ./activemq status 信息:正在加载'/opt/runtime/apache-activemq-5.11.1/bin/env' 信息:使用java '/usr/bin/java' ActiveMQ正在运行(pid '29887')


如果你有 /etc/default/activemq 定义了 ACTIVEMQ_USER,那么你必须以 root 身份启动脚本。因此,要么使用 sudo,要么删除 /etc/default/activemq - laurent
遇到了完全相同的问题,当用户=activemq时在active-mq.service上。将其替换为root,现在一切都开始了。谢谢。 - Andrey Kusnetsov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接