How do I correctly specify JAVA_HOME in tomcat?

  • 0
    Hello everyone!

    I am trying to install tomcat under ubuntu using 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 to the console:

    tomcat start / post-stop, process 3765


    What this means I have no idea, but the server is not working. Perhaps the problem is in the specified JAVA_HOME, as this is the only discrepancy with the manual. Since sudo update-alternatives --config java produces:

    There are 4 options for the java alternative (provides / usr / bin / java).

    Select Path Prior State
    -------------------------------------------------- ----------
    0 / usr / lib / jvm / java-8-oracle / jre / bin / java 1081 automatic 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 sudo nano /etc/init/tomcat.conf I have:

    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, rights granted:

    sudo ls -al conf /

    total 232
    drwxrwx --- 2 root tomcat 4096 Oct. 6 11:18 pm.
    drwxr-xr-x 9 root root 4096 oct. 21 20:23 ..
    -rw-r ----- 1 root tomcat 12895 oct. 6 23:18 catalina.policy
    -rw-r ----- 1 root tomcat 7202 oct. 6 23:18 catalina.properties
    -rw-r ----- 1 root tomcat 1338 oct. 6 23:18 context.xml
    -rw-r ----- 1 root tomcat 1149 oct. 6 23:18 jaspic-providers.xml
    -rw-r ----- 1 root tomcat Oct 2358 6 23:18 jaspic-providers.xsd
    -rw-r ----- 1 root tomcat 3622 oct. 6 23:18 logging.properties
    -rw-r ----- 1 root tomcat 7283 oct. 6 23:18 server.xml
    -rw-r ----- 1 root tomcat Oct 2239 21 20:41 tomcat-users.xml
    -rw-r ----- 1 root tomcat 2633 oct. 6 23:18 tomcat-users.xsd
    -rw-r ----- 1 root tomcat 168133 oct. 6 23:18 web.xml
    Java Zoey Krause, Mar 15, 2020

  • 1 Answers
  • 0
    try to set the rights 777 and you will definitely understand because of the rights the server does not start or because of the clumsy settings
    Sophie Cordova

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!