I always get this message that I can't follow:
sudo systemctl status -l tomcat8.service
● tomcat8.service - LSB: Start Tomcat.
Loaded: loaded (/etc/init.d/tomcat8)
Active: failed (Result: exit-code) since sáb 2015-05-09 00:48:07 CEST; 2h 31min ago
Docs: man:systemd-sysv-generator(8)
Process: 1295 ExecStart=/etc/init.d/tomcat8 start (code=exited, status=127)
may 09 00:48:07 vaio systemd[1]: Starting LSB: Start Tomcat....
may 09 00:48:07 vaio tomcat8[1295]: [58B blob data]
may 09 00:48:07 vaio systemd[1]: tomcat8.service: control process exited, code=exited status=127
may 09 00:48:07 vaio systemd[1]: Failed to start LSB: Start Tomcat..
may 09 00:48:07 vaio systemd[1]: Unit tomcat8.service entered failed state.
may 09 00:48:07 vaio systemd[1]: tomcat8.service failed.
Any idea?
Thank you in advance!!
I had the same error when I upgraded Ubuntu and also Java (8->11). The problem was a wrong JAVA_HOME path inside the systemd module. The JAVA_HOME path had "jre/" at the end which is wrong for newer Java versions. Solution:
/etc/systemd/system/tomcat.service
and remove the trailing "jre/" of the JAVA_HOME path.systemctl daemon-reload
systemctl restart tomcat
Value 127 is returned by
/bin/sh
when the given command is not found within yourPATH
system variable and it is not a built-in shell command. In other words, the system doesn't understand your command, because it doesn't know where to find the binary you're trying to call.for more info LINK
Something must got corrupted in the installation of Tomcat. I could not do apt-get remove tomcat8 nor apt-get purge tomcat8. I deleted the conf folder and saved my server.xml file and webapps folders. Then I was able to do a purge of tomcat followed by a fresh install and replacement of server.xml file with mine and I was running again.
Still do not know what corrupted the tomcat installation, but I was finally able to move on.
Thank you all for your suggestions.
Hi All i got something its working for me,so please try my procedure
First goto service file in init.d
turn out into a execution file by adding below code at tomcat8
Some times Java Home is not properly set at environment so Export the java home and set process id (PID) for tomcat in Catalina.sh file
Add the following codes at the starting of catalina.sh file
For exporting java home, Use the respected java version to set path i actually installed java at /usr/java/
It the last step now add the tomcat pid for catalina add the following code after setting java home
Now go to terminal start the tomcat service
We need to reload system deamon
its worked out for me feel free to ask questions
this happens in ubuntu 15.04
source:wiki.ubuntu.com/SystemdForUpstartUsers
The issue is with /etc/init.d/tomcat8, java folder detection
So if it can't find java under /usr/lib/jvm/jre-${java_version}-oracle-* folder it was defaulting to java-7-oracle which was for java 7 if you have installed using apt-get; you will need to fix that to default to java-8-oracle.
So, I had to change
JDK_DIRS="${JDK_DIRS} /usr/lib/jvm/java-7-oracle"
toJDK_DIRS="${JDK_DIRS} /usr/lib/jvm/java-8-oracle"
to get this workingI got this error because I was setting
JAVA_HOME
in/usr/share/tomcat8/bin/setenv.sh
. The services script for tomcat/etc/init.d/tomcat8
instead wants you set up the tomcat environment in/etc/default/tomcat8
. Once I put my settings into/etc/default/tomcat8
then deleted/usr/share/tomcat8/bin/setenv.sh
tomcat started up just fine.The reason appears to be that
/etc/init.d/tomcat8
tries to figure out which JVM is used but ignores/usr/share/tomcat8/bin/setenv.sh
. It uses the JVM info to look at the process list and see if tomcat is running. If you use setenv.sh, tomcat gets started with a different JVM than the one that init.d expects. It then can't see it in the process list and reports that it failed to start.In my case
JAVA_HOME path
was incorrectchange it by editing
and remove the trailing "jre/"` of the JAVA_HOME path.
it will look something like this after editing
now do
i also got this error while starting tomcat service.in tomcat.service file when i checked [Service] section then i find that jre was not created so i remove the jre word.First it was like this "Environment=JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/jre" i removed jre and it became like this "Environment=JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64" after that i started service.it worked.