2

I am a newbie to Apache Active MQ. I am following the instructions from here

I don't need multiple instances of Active MQ, just trying a HelloWorld using ActiveMQ. But i start i get the following below error

vinod@BBLPT0326:/srv/activemq/current$ /etc/init.d/activemq start

INFO: Loading '/etc/default/activemq' INFO: Using java '/opt/software/java/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details /etc/init.d/activemq: 300: /etc/init.d/activemq: "/opt/software/java/bin/java" -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/srv/activemq/apache-activemq-5.11.1/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir="/srv/activemq/apache-activemq-5.11.1/tmp" -Dactivemq.classpath="/srv/activemq/apache-activemq-5.11.1/conf:" -Dactivemq.home="/srv/activemq/apache-activemq-5.11.1" -Dactivemq.base="/srv/activemq/apache-activemq-5.11.1" -Dactivemq.conf="/srv/activemq/apache-activemq-5.11.1/conf" -Dactivemq.data="/srv/activemq/apache-activemq-5.11.1/data" -jar "/srv/activemq/apache-activemq-5.11.1/bin/activemq.jar" start >/dev/null 2>&1 & RET="$?"; APID="$!"; echo $APID > /srv/activemq/apache-activemq-5.11.1/data/activemq.pid; echo "INFO: pidfile created : '/srv/activemq/apache-activemq-5.11.1/data/activemq.pid' (pid '$APID')";exit $RET: not found

When tried with SUDO i get a different error as below

vinod@BBLPT0326:/srv/activemq/current$ sudo /etc/init.d/activemq start

INFO: Loading '/etc/default/activemq' ERROR: Configuration variable JAVA_HOME or JAVACMD is not defined correctly. (JAVA_HOME='', JAVACMD='java')

My JAVA_HOME is defined. I verified the same as below.

vinod@BBLPT0326:/srv/activemq/current$ echo $JAVA_HOME

/opt/software/java

I already referred solution here as I am using Ubuntu 14.0.4.

But I am not really clear as I don't have a path /etc/activemq/instances-enabled and from where should I execute the command sudo ln -s ../instances-available/main/

Community
  • 1
  • 1
Vinod Jayachandran
  • 3,726
  • 8
  • 51
  • 88

2 Answers2

4

I am answering my own question here.

In ubuntu 14.0.4 root cause of the problem is

INFO: Loading '/etc/default/activemq' ERROR: Configuration variable JAVA_HOME or JAVACMD is not defined correctly. (JAVA_HOME='', JAVACMD='java')

Even if you define JAVA_HOME in /etc/environment, active MQ reads only from either of the below locations where ever if finds the file first.

  1. /etc/default/activemq
  2. $HOME/.activemqrc
  3. $INSTALLDIR/apache-activemq-/bin/env

So I recommend defining JAVA_HOME in /etc/default/activemq (which is copied from $INSTALLDIR/apache-activemq-/bin/env)

I did as below

JAVA_HOME="/opt/software/java/jre" JAVACMD="/opt/software/java/jre/bin/java"

Vinod Jayachandran
  • 3,726
  • 8
  • 51
  • 88
  • JAVA_HOME="/opt/software/java/jre" JAVACMD="/opt/software/java/jre/bin/java" did the trick for me – Kshitij Mar 02 '21 at 09:02
0

If you are just needing jre instead of the whole jdk then reinstalling jre worked for me:

sudo apt-get install openjdk-7-jre-headless
ShaneMit
  • 171
  • 1
  • 7