I followed this tutorial https://howtoprogram.xyz/2017/08/09/how-to-install-activemq-on-ubuntu-16-04-lts-xenial-xerus/ to install ActiveMQ manually and everything worked fine and i was even able to access the webhost on http://127.0.0.1:8161. But I tried the sudo apt-get install automatic option out of curiosity and though it was also successful, I cannot access the web console for both installations now though I am able to start them. Below are snippets of the output:
● activemq.service - LSB: ActiveMQ instance
Loaded: loaded (/etc/init.d/activemq; generated)
Active: active (running) since Thu 2019-03-28 22:52:17 GMT; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 14696 ExecStop=/etc/init.d/activemq stop (code=exited, status=0/SUCCE
Process: 15233 ExecStart=/etc/init.d/activemq start (code=exited, status=0/SUC
Tasks: 31 (limit: 4915)
CGroup: /system.slice/activemq.service
└─15265 /usr/lib/jvm/default-java//bin/java -Xms512M -Xmx512M -Dorg.a
Mar 28 22:52:11 sys-abj systemd[1]: Starting LSB: ActiveMQ instance...
Mar 28 22:52:11 sys-abj activemq[15233]: * Starting ActiveMQ instance activemq
Mar 28 22:52:17 sys-abj activemq[15233]: ...done.
Mar 28 22:52:17 sys-abj systemd[1]: Started LSB: ActiveMQ instance.
and a netstat to the transportConnector tells it's listening by yielding this result:
tcp6 0 0 127.0.0.1:61616 :::* LISTEN 15265/java
However, any time I point to 127.0.0.1:8161, I get no feed back.
I stumbled upon this How to install or config activemq admin cosole(jetty) use apt-get command? link but I still can't wrap my head around how to configure the web console.
Any help would be much appreciated
I have been able to fix it!
I deleted ActiveMQ and its accompanying dependencies by running sudo apt-get remove --auto-remove activemq, downloaded the zip file again from https://activemq.apache.org/download.html and unzipped it to my preferred destination.
I wouldn't recommend anyone running the sudo apt-get install activemq command if you're not sure of what you're doing
Related
I have created a fat-jar for my apache camel 3 route. I put that on my raspberry pi (bullseye) in /opt/myhome and could start it successfully with java 17 (also works with sudo):
/usr/bin/java -jar /opt/myhome/myhome-1.0-SNAPSHOT-jar-with-dependencies.jar
Then I have added /lib/systemd/system/myhome.service as:
[Unit]
Description=My home automation with apache camel 3.
After=network.target
[Service]
ExecStart=/usr/bin/java -jar /opt/myhome/myhome-1.0-SNAPSHOT-jar-with-dependencies.jar > /var/log/myhome.log 2>&1
[Install]
WantedBy=network.target
Then I did:
sudo systemctl daemon-reload
sudo systemctl enable myhome.service
sudo systemctl start myhome.service
After starting and waiting for some seconds I executed
systemctl status myhome.service
Which displays me
● myhome.service - My home automation with apache camel 3.
Loaded: loaded (/lib/systemd/system/myhome.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2022-10-07 18:28:52 CEST; 1h 18min ago
Process: 18159 ExecStart=/usr/bin/java -jar /opt/myhome/myhome-1.0-SNAPSHOT-jar-with-dependencies.jar > /var/>
Main PID: 18159 (code=exited, status=0/SUCCESS)
CPU: 10.174s
systemd[1]: Started My home automation with apache camel 3..
java[18159]: WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
java[18159]: Apache Camel Runner takes the following options
java[18159]: -h or -help = Displays the help screen
java[18159]: -r or -routers <routerBuilderClasses> = Sets the router builder classes which will be loaded while starting the camel context
java[18159]: -d or -duration <duration> = Sets the time duration (seconds) that the application will run for before terminating.
java[18159]: -dm or -durationMaxMessages <durationMaxMessages> = Sets the duration of maximum number of messages that the application will process before terminating.
java[18159]: -di or -durationIdle <durationIdle> = Sets the idle time duration (seconds) duration that the application can be idle before terminating.
java[18159]: -t or -trace = Enables tracing
java[18159]: -ts or -traceStandby = Enables tracing standby
java[18159]: -e or -exitcode <exitcode> = Sets the exit code if duration was hit
java[18159]: -pl or -propertiesLocation <propertiesLocation> = Sets location(s) to load properties, such as from classpath or file system.
systemd[1]: myhome.service: Succeeded.
systemd[1]: myhome.service: Consumed 10.174s CPU time.
So this means the process was started, but then not the same as when starting the jar manually happens, but a help message seems to appear.
So the question is, why did the jar behaves differently as when started manually?
I also tested to change the code in myhome.service to:
/usr/bin/java -jar /opt/myhome/myhome-1.0-SNAPSHOT-jar-with-dependencies.jar -e 10 -d 60 -r de.powerstat.camel.homeautomation.HomeautomationRouteBuilder > /var/log/myhome.log 2>&1
Which results in the same as above. So no different exit code because of a timeout, or a not found route class.
What point did I miss here?
Update 1:
Completed the systemctl status output. Looks like this comes from org.apache.camel.main.MainCommandLineSupport
So the question is still why this shows up when starting in systemd context and not when starting within the bash?
Within my jar file the META-INF/MANIFEST.MF looks like:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: PowerStat
Build-Jdk: 17.0.2
Main-Class: de.powerstat.camel.homeautomation.MainApp
while the MainApp class is defined as follows:
public class HomeautomationRouteBuilder extends RouteBuilder
After some research I found out that "> /var/log/myhome.log 2>&1" will be passed as three parameters to args. Because these parameters are not recognized results in the shown help message.
Run Tomcat8 in centos7, Checked the tomcat status get following information:
[root#**** conf]# systemctl status tomcat
● tomcat.service - Apache Tomcat 8 Servlet Container
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-11-10 09:39:22 EST; 37min ago
Process: 1013 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=0/SUCCESS)
Main PID: 1102 (java)
CGroup: /system.slice/tomcat.service
└─1102 /usr/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=o...
Nov 10 09:39:22 ****** systemd[1]: Starting Apache Tomcat 8 Servlet Container...
Nov 10 09:39:22 ****** systemd[1]: Started Apache Tomcat 8 Servle
But when check the homepage of tomcat (http://..***:8080), in Chrome,
Get the following information:
This page isn’t working
***.**.***.** didn’t send any data. ERR_EMPTY_RESPONSE
The centos 7 is with firewall and it running.
Thanks,
-Jimmy
I have recently upgraded my machine from Ubuntu 14.04 to 16.04. I am facing problem of using the elasticsearch as a service. I installed elasticsearch using:
sudo apt-get install elasticsearch
Now sudo service elasticsearch status command shows me this result:
elasticsearch.service - LSB: Starts elasticsearch
Loaded: loaded (/etc/init.d/elasticsearch; bad; vendor preset: enabled)
Active: active (exited) since Sat 2016-07-30 18:28:13 BDT; 1h 19min ago
Docs: man:systemd-sysv-generator(8)
Main PID: 7988 (code=exited, status=1/FAILURE)
CGroup: /system.slice/elasticsearch.service
Jul 30 18:28:13 dimik elasticsearch[10266]: [warning] /etc/init.d/elasticsearch: No java runtime was found
Jul 30 18:28:13 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 18:28:46 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 18:35:30 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 19:04:36 dimik systemd[1]: Started A search engine.
Jul 30 19:07:48 dimik systemd[1]: Started A search engine.
Jul 30 19:27:01 dimik systemd[1]: Started A search engine.
Jul 30 19:27:51 dimik systemd[1]: Started A search engine.
Jul 30 19:28:54 dimik systemd[1]: Started A search engine.
Jul 30 19:29:18 dimik systemd[1]: Started LSB: Starts elasticsearch.
Although Java is installed in my machine and I can start the server using this command.
sudo /usr/share/elasticsearch/bin/elasticsearch
I am kind of stuck here. Any help will be appreciated.
Edit
After setting up JAVA_HOME for root the error:
elasticsearch.service - LSB: Starts elasticsearch
Loaded: loaded (/etc/init.d/elasticsearch; bad; vendor preset: enabled)
Active: active (exited) since Sat 2016-07-30 18:28:13 BDT; 3h 32min ago
Docs: man:systemd-sysv-generator(8)
Main PID: 7988 (code=exited, status=1/FAILURE)
CGroup: /system.slice/elasticsearch.service
Jul 30 18:35:30 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 19:04:36 dimik systemd[1]: Started A search engine.
Jul 30 19:07:48 dimik systemd[1]: Started A search engine.
Jul 30 19:27:01 dimik systemd[1]: Started A search engine.
Jul 30 19:27:51 dimik systemd[1]: Started A search engine.
Jul 30 19:28:54 dimik systemd[1]: Started A search engine.
Jul 30 19:29:18 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 20:02:07 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 20:20:21 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 21:59:21 dimik systemd[1]: Started LSB: Starts elasticsearch.
I found the solution for this issue. The solution comes from this discussion thread- Can’t start elasticsearch with Ubuntu 16.04 on elastic's website.
It seems that to get Elasticsearch to run on 16.04 you have to set START_DAEMON to true on /etc/default/elasticsearch. It comes commented out by default, and uncommenting it makes Elasticsearch start again just fine.
Be sure to use systemctl restart instead of just start because the
service is started right after installation, and apparently there's
some socket/pidfile/something that systemd keeps that must be released
before being able to start the service again.
The problem lies on log files, "No java runtime was found."
Jul 30 18:28:13 dimik elasticsearch[10266]: [warning] /etc/init.d/elasticsearch: No java runtime was found
Here's my solution to the problem.
Check elasticsearch init file
sudo nano /etc/init.d/elasticsearch
search for
. /usr/share/java-wrappers/java-wrappers.sh
find_java_runtime openjdk8 oracle8 openjdk7 oracle7 openjdk6 sun6 default
export JAVA_HOME
Check java-wrappers.sh file
sudo nano /usr/share/java-wrappers/java-wrappers.sh
Now you could see the warning comes from
#Displays a warning
java_warning() {
echo "[warning] $0: $#" >&2;
}
Somehow, java directories are not listed in jvm-list.sh files
Now edit the jvm-list.sh file
sudo nano /usr/lib/java-wrappers/jvm-list.sh
Edit the line add your java directories files, in my case add /usr/lib/jvm/java-8-oracle*
__jvm_oracle8="/usr/lib/jvm/jdk-8-oracle-* /usr/lib/jvm/jre-8-oracle-* /usr/lib/jvm/java-8-oracle*"
Now restart the service and check elasticsearch services
sudo systemctl restart elasticsearch
sudo systemctl elasticsearch status
curl -X GET "http://localhost:9200"
Hopes this would help
My problem was different, I started elasticsearch manually as root user, so some files were created with wrong ownership, so elasticsearch user cannot write on them.
You can try to start elasticsearch from console to see errors:
sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch \
-Des.default.config=/etc/elasticsearch/elasticsearch.yml \
-Des.default.path.home=/usr/share/elasticsearch \
-Des.default.path.logs=/var/log/elasticsearch \
-Des.default.path.data=/var/lib/elasticsearch \
-Des.default.path.work=/tmp/elasticsearch \
-Des.default.path.conf=/etc/elasticsearch
To fix on my machine I had to do:
rm -rf /var/log/elasticsearch/*
rm -rf /var/lib/elasticsearch/*
Open /etc/init.d/elasticsearch file in editor, Comment below lines
. /usr/share/java-wrappers/java-wrappers.sh
find_java_runtime openjdk8 oracle8 openjdk7 oracle7 openjdk6 sun6 default
Set JAVA_HOME manually like so:
export JAVA_HOME="/usr"
service elasticsearch start
Remove unnecessary java packages using
sudo apt autoremove
Then install elasticsearch again and start it as
sudo apt install elasticsearch
service elasticsearch status
Have you enabled the service ?
systemctl enable elasticsearch
I'm fairly new to MongoDB and LDAP. I'm trying to use LDAP to authenticate users to mongo. these are the steps I have done so far.
Created a saslauthd.conf file inside /etc folder which contains the following line:
ldap_servers: ldap://com.myldap.server
ldap_use_sasl: yes
ldap_mech: DIGEST-MD5
ldap_auth_method: fastbind
created a muxdir inside /var/run/saslauthd which now looks like /var/run/saslauthd/mux
set the permission to 755 using sudo chmod 755 /var/run/saslauthd
Modified the /etc/sysconfig/saslauthd to have the following
MECH=ldap
Uncommented the line on the same file which says:
DAEMONOPTS=--user saslauth
Now when i tried to test the authentication mechanism using the following command:
testsaslauthd -u username -p password -f /var/run/saslauthd/mux
I'm getting the following message:
connect(): Permission Denied
my work is based on this and this
Could anyone point out what i'm missing here? thanks in advance.
UPDATE:
I tried the test command with sudo like below:
sudo testsaslauthd -u username -p password -f /var/run/saslauthd/mux
And I'm getting the following:
connect() : Connection refused
Thanks for your question. I've enjoyed setting up my environment to try to reproduce the error. You'll be glad to heard that I don't think it's a difficult problem to overcome. However, I've probably spent more time than I desired setting up MongoDB, cyrus-sasl-md5, settings permissions, etc. when nothing is actually related with your problem, at least at a first glance.
Your problem (and I'm 90% sure) is either your saslauthd daemon is not running or it's not properly configured. Let's take a look at the following:
Check the service status. The output of service saslauthd status should be similar to mine, pasted below. Note some key values such as the location of the init script, /etc/init.d/saslauthd/ in my case; and the socket, /var/run/saslauthd/mux, the same file location you need to put in testsaslauthd [...] -f /var/run/saslauthd/mux command.
root#hectorvp-pc:~# service saslauthd status
● saslauthd.service - LSB: saslauthd startup script
Loaded: loaded (/etc/init.d/saslauthd)
Active: active (running) since Tue 2016-04-26 12:04:59 BST; 1s ago
Docs: man:systemd-sysv-generator(8)
Process: 11569 ExecStop=/etc/init.d/saslauthd stop (code=exited, status=0/SUCCESS)
Process: 11586 ExecStart=/etc/init.d/saslauthd start (code=exited, status=0/SUCCESS)
Memory: 2.0M
CGroup: /system.slice/saslauthd.service
├─11606 /usr/sbin/saslauthd -a ldap -c -m /var/run/saslauthd -n 5
├─11607 /usr/sbin/saslauthd -a ldap -c -m /var/run/saslauthd -n 5
├─11608 /usr/sbin/saslauthd -a ldap -c -m /var/run/saslauthd -n 5
├─11609 /usr/sbin/saslauthd -a ldap -c -m /var/run/saslauthd -n 5
└─11610 /usr/sbin/saslauthd -a ldap -c -m /var/run/saslauthd -n 5
Apr 26 12:04:59 hectorvp-pc systemd[1]: Starting LSB: saslauthd startup script...
Apr 26 12:04:59 hectorvp-pc saslauthd[11586]: * Starting SASL Authentication Daemon saslauthd
Apr 26 12:04:59 hectorvp-pc saslauthd[11606]: detach_tty : master pid is: 11606
Apr 26 12:04:59 hectorvp-pc saslauthd[11606]: ipc_init : listening on socket: /var/run/saslauthd/mux
Apr 26 12:04:59 hectorvp-pc systemd[1]: Started LSB: saslauthd startup script.
Apr 26 12:04:59 hectorvp-pc saslauthd[11586]: ...done.
If the service is not running, just start it with service saslauthd start and check the status again (service saslauthd status) to check any possible upstream error.
It's also likely your ldap server is not running or missconfigured. You can take a look to the service status as above (service slapd status).
Please, try this and tell us about the outcome.
EDIT (26/04/2016): From the conversation in the comments of this answer, I've extracted some more steps. Please, apologize for the extensive conversation below the answer, its summarized here:
Debug saslauthd service: As indicated here, this service uses the system logs. In my case (Ubuntu) those logs are in /var/log/syslog but they might be in /var/log/messages in your case. At least by default. Look at this logs at the time you try to start the service and see if you see any error message that might give you some further insights about what the problem is.
The error appearing in /var/logs/messages was: could not bind to socket : /var/run/saslauthd/mux , bind: address already in use.
We checked the mux socket using the file command: file /var/run/saslauthd/mux and the output said it was a directory. It should be a socket. Then we removed it and restarted the service. Now the service works.
I am unable to shutdown tomcat. When I do ./shutdown.sh, I don't see any error, but the process still seems to be running. When I kill the process (kill -9), the process gets killed. After this, if I do a startup, and shutdown again, I see the same problem. How do I gracefully shut it down? Why is this happening in the first place? Please help me.
devServer:bin dev$ ps -ef|grep tomcat
501 34933 1 0 11:24PM test 0:02.02 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Djava.util.logging.config.file=/Users/dev/admin/runtime/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/Users/dev/admin/runtime/endorsed -classpath /Users/dev/admin/runtime/bin/bootstrap.jar:/Users/dev/admin/runtime/bin/tomcat-juli.jar -Dcatalina.base=/Users/dev/admin/runtime -Dcatalina.home=/Users/dev/admin/runtime -Djava.io.tmpdir=/Users/dev/admin/runtime/temp org.apache.catalina.startup.Bootstrap start
501 34982 33786 0 11:45PM test 0:00.00 grep tomcat
devServer:bin dev$ ./shutdown.sh
Using CATALINA_BASE: /Users/dev/admin/runtime
Using CATALINA_HOME: /Users/dev/admin/runtime
Using CATALINA_TMPDIR: /Users/dev/admin/runtime/temp
Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Using CLASSPATH: /Users/dev/admin/runtime/bin/bootstrap.jar:/Users/dev/admin/runtime/bin/tomcat-juli.jar
devServer:bin dev$ ps -ef|grep tomcat
501 34933 1 0 11:24PM test 0:02.03 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Djava.util.logging.config.file=/Users/dev/admin/runtime/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/Users/dev/admin/runtime/endorsed -classpath /Users/dev/admin/runtime/bin/bootstrap.jar:/Users/dev/admin/runtime/bin/tomcat-juli.jar -Dcatalina.base=/Users/dev/admin/runtime -Dcatalina.home=/Users/dev/admin/runtime -Djava.io.tmpdir=/Users/dev/admin/runtime/temp org.apache.catalina.startup.Bootstrap start
501 34992 33786 0 11:45PM test 0:00.00 grep tomcat
devServer:bin dev$
Also, I see my catalina.out is rather too short. There is no port number info getting written to it at all. This is all I see everytime I startup.
Feb 15, 2014 11:24:23 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Here is my log file -
devServer:logs dev$ cat catalina.2014-02-15.log
Feb 15, 2014 11:24:23 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Something seems to be terribly messed up. I can't understand what. Please advise.
I am running tomcat 7.0.50 on Mac OS.
Judging by the logs, it is evident that tomcat is not starting up at all as it should be. I can advise a couple of other tests as well like to
Verify whether or not the ports are getting bound by the tomcat service or not. You can do this by issueing the command netstat -tuplen on the terminal and check to see if port 8080 is getting bound by the tomcat instance or not.
Check to see if you can ping the instance. Try to ping the tomcat instance from a local machine. Then try to ping the public ip of the server to verify whether that server is responding correctly or not
Verify that you have, infact, the complete tomcat template as is used by your other servers. Verify the tomcat installtion folder and compare it with the other tomcat templates as used in rest of your servers. Make sure all folders are there, all configuration (default tomcat config) files are present.
(Just a hunch) Verify read/write/execute privileges as well
Remove your application, shutdown tomcat, empty the logs, and then restart tomcat and re-deploy your application and then view the logs to see if you get some error
Point 3 seems more likely that you have an incomplete tomcat instance, so I advise you to make a copy of the tomcat instance used in any other server and use it in this server to make sure that the server environment is infact how it should be