J
J
JavaWorm2016-10-22 11:06:24
linux
JavaWorm, 2016-10-22 11:06:24

How to correctly specify JAVA_HOME in tomcat?

Hello!
I'm trying to install tomcat under ubuntu according to this manual https://www.8host.com/blog/ustanovka-apache-tomcat...
Everything seems to be more or less clear, but in the end the server does not start. sudo initctl start tomcat outputs in the console:

tomcat start/post-stop, process 3765

I have no idea what that means, but the server is down. Perhaps the problem is in the specified JAVA_HOME, since this is the only discrepancy with the manual. Since sudo update-alternatives --config java produces:
There are 4 options for alternative java (provides /usr/bin/java).
Choice Path Prior State
---------------------------------------- --------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 auto mode
* 1 /usr/lib/jvm/java-7-openjdk -amd64/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode
3 /usr/local/java/jdk1.8.0_101/bin/java 1 manual mode
4 /usr/local/java/jdk1.8.0_101/bin/javac 1 manual mode

Here I have sudo nano /etc/init/tomcat.conf:
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid tomcat
setgid tomcat
env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
env CATALINA_HOME=/ opt/tomcat
# Modify these options as needed
env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX: +UseParallelGC"
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
rm -rf $CATALINA_HOME/temp/*
end script

What am I doing wrong? User created, permissions granted:
sudo ls -al conf/
total 232
drwxrwx--- 2 root tomcat Oct 4096 6 23:18 .
drwxr-xr-x 9 root root 4096 Oct. 21 20:23 ..
-rw-r----- 1 root tomcat Oct 12895 6 23:18 catalina.policy
-rw-r----- 1 root tomcat Oct 7202 6 23:18 catalina.properties
-rw-r----- 1 root tomcat Oct 1338 6 23:18 context.xml
-rw-r----- 1 root tomcat Oct 1149 6 23:18 jaspic-providers.xml
-rw-r----- 1 root tomcat Oct 2358 6 23:18 jaspic-providers.xsd
-rw-r----- 1 root tomcat Oct 3622 6 23:18 logging.properties
-rw-r----- 1 root tomcat Oct 7283 6 23:18 server.xml
-rw-r----- 1 root tomcat Oct 2239 21 20:41 tomcat-users.xml
-rw-r----- 1 root tomcat Oct 2633 6 23:18 tomcat-users.xsd
-rw-r----- 1 root tomcat 168133 Oct. 6 23:18 web.xml

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Aitkulov, 2016-10-23
@Scarfase1989

try to set 777 rights and you will understand exactly because of the rights the server does not start or because of the clumsy settings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question