Results 1 to 6 of 6

Thread: how to run tomcat 8.0.53 unit systemd file opensuse 15.0

  1. #1
    Join Date
    Oct 2014
    Location
    Brazil
    Posts
    46

    Default how to run tomcat 8.0.53 unit systemd file opensuse 15.0

    Hello!
    How are you?

    We need to run tomcat 8.0.53 in opensuse 15.0. One method that I did use in other opensuse (42.2) was: Install tomcat by opensuse package: zypper install tomcat . So, I did download tomcat 8.0.53 by tomcat website. I tested in terminal running ./startup.sh (from tomcat 8.0.53 /bin directory and our other config) and ok running. At /etc/tomcat/tomcat.conf I put the path about:

    Code:
    #Where your java installation lives
    JAVA_HOME="/usr/libi64/jvm/jre-11"
    Code:
    # Where your tomcat installation lives
    CATALINA_HOME="/usr/share/tomcat" (path from tomcat 8.0.53)
    and ok,
    Go to Yast - services manager - tomcat - start boot - on boot - Save -
    In OPENSUE 42.2 it runs tomcat version 8.0.53 ok, nice and from boot


    So, I did try the same config in Opensuse 15.0. In opensuse 15.0 in packages it installs tomcat 9. After put the paths at /etc/tomcat/tomcat.conf from tomcat 8.0.53
    run the command:

    systemctl tomcat start
    systemctl tomcat status

    and show me:

    Nov 29 09:28:48 equiplanov server[14069]: See the Home Screen API documentation for more information�>
    Nov 29 09:28:48 equiplanov server[14069]: @argument files
    Nov 29 09:28:48 equiplanov server[14069]: One or more argument files containing options
    Nov 29 09:28:48 equiplanov server[14069]: -disable-@files
    Nov 29 09:28:48 equiplanov server[14069]: Prevents further expansion of argument file
    Nov 29 09:28:48 equiplanov server[14069]: nTo specify an argument for a long option, you can use - <name> = <value> or
    Nov 29 09:28:48 equiplanov server[14069]: --<name> <value>.
    Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Main process exited, code=exited, status=1/FAILURE
    Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Unit entered failed state.
    Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Failed with result 'exit-code'.

    So, please any Idea how to solve this

    I can not install tomcat 9, for that app needs to be tomcat 8.0.53 version!


    Thanks attention and help

    Douglas

  2. #2
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,079

    Default Re: how to run tomcat 8.0.53 unit systemd file opensuse 15.0

    What is in the systemd unit file you created?
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  3. #3
    Join Date
    Oct 2014
    Location
    Brazil
    Posts
    46

    Default Re: how to run tomcat 8.0.53 unit systemd file opensuse 15.0

    Hello

    How are you?

    the original unit file is:

    # Systemd unit file for default tomcat
    #
    # To create clones of this service:
    # DO NOTHING, use tomcat@.service instead.

    [Unit]
    Description=Apache Tomcat Web Application Container
    After=syslog.target network.target

    [Service]
    TasksMax=576
    LimitNOFILE=8192
    Type=simple
    EnvironmentFile=/etc/tomcat/tomcat.conf
    Environment="NAME="
    EnvironmentFile=-/etc/sysconfig/tomcat
    ExecStart=/usr/lib/tomcat/server start
    ExecStop=/usr/lib/tomcat/server stop
    SuccessExitStatus=143
    User=tomcat
    Group=tomcat


    [Install]
    WantedBy=multi-user.target

    -------------------------------------------------------------------

    This, I did configuration


    cat tomcat@.service
    [Unit]
    Description=Apache Tomcat
    After=syslog.target network.target

    [Service]
    Type=forking

    # User=tomcat
    # Group=tomcat

    Environment=JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11/
    Environment=CATALINA_PID=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53/tomcat.pid
    Environment=CATALINA_HOME=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53
    Environment=CATALINA_BASE=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53
    # Environment="CATALINA_OPTS=-Xms128M -Xmx765M -server -XX:+Paracelulose"
    # Environment="JAVA_OPTS=-Djava.awt.haedless=true -Djava.security.egd=file:/dev/./urandom"

    WorkingDirectory=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53

    ExecStart=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53/bin/startup.sh
    ExecStop=/srv/equiplano/sistemasequiplanoweb/tomcat/apache-tomcat-8.0.53/bin/shutdown.sh

    User=tomcat
    Group=tomcat

    [Install]
    WantedBy=multi-user.target


    After, put java path and catalina path at /etc/tomcat/tomcat.conf

    Thnaks

  4. #4
    Join Date
    Oct 2014
    Location
    Brazil
    Posts
    46

    Default Re: how to run tomcat 8.0.53 unit systemd file opensuse 15.0

    Any ideia, how to solve this?

  5. #5
    Join Date
    Oct 2014
    Location
    Brazil
    Posts
    46

    Default (solved) Re: how to run tomcat 8.0.53 unit systemd file opensuse 15.0

    Hello All

    The steps to solve

    1- I did install opensuse 15 as "new" installation
    in terminal: zypper up

    2 - Create tomcat group and user:
    Group:
    Code:
    groupadd tomcat
    create tomcat user and put it tomcat group
    Code:
    useradd tomcat -M -N -g tomcat
    3 - Download tomcat 8.0.53:
    cd /srv/opt
    Code:
    wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.53/bin/apache-tomcat-8.0.53.tar.gz
    4 - unpak the tar.gz
    Code:
    tar -xzvf apache....press tab
    5 - cd to /bin apache directory
    Code:
    cd /srv/opt/apache-tomcat-8.0.53/bin
    -

    6 - create setenv.sh file
    Code:
    nano setenv.sh
    7 - Put the JAVA_HOME path
    Code:
    JAVA_HOME="/usr/lib64/jvm/java-11-openjdk-11"
    8 - Inside setenv.sh put your JAVA_OPTS for example:
    Code:
    export JAVA_OPTS=......
    save file

    9 - change the owner apache tomcat diretory
    Code:
    chown -R tomcat.tomcat apache-tomcat-8.0.53/
    10 - Create tomcat.service unit in /usr/lib/systemd/system:

    Code:
    Description=Tomcat 8 service
    
    After=syslog.targetnetwork.target
    
    [Service]
    Type=forking
    
    User=tomcat
    Group=tomcat
    
    Environment="JAVA_HOME=/usr/lib64/jvm/java-11-openjdk-11/"
    Environment="CATALINA_PID=/srv/opt/apache-tomcat-8.0.53/tomcat.pid"
    Environment="CATALINA_HOME=/srv/opt/apache-tomcat-8.0.53/"
    Environment="CATALINA_BASE=/srv/opt/apache-tomcat-8.0.53/"
    
    ExecStart=/srv/opt/apache-tomcat-8.0.53/bin/startup.sh
    ExecStop=/srv/opt/apache-tomcat-8.0.53/bin/shutdown.sh
    
    [Install]
    WantedBy=multi-user.target
    11 - Reload systemctl daemin
    Code:
    systemctl daemon-reload
    12 - Start tomcat
    Code:
    systemctl start tomcat
    13 - verify tomcat status
    Code:
    systemctl status tomcat
    14 - stop tomcat
    Code:
    systemctl stop tomcat
    15 - Enable service tomcat in boot
    Code:
    systemctl enable tomcat.service
    16 - Go to yast - services manager - search for tomcat and verify if Start mode is "On Boot". Change if need - press OK.

    17 - Reboot the system

    18 - After boot, open firefox and access: localhost:8080
    Tomcat webpage should appear

    Thank you!

    Douglas









    How are you?

    We need to run tomcat 8.0.53 in opensuse 15.0. One method that I did use in other opensuse (42.2) was: Install tomcat by opensuse package: zypper install tomcat . So, I did download tomcat 8.0.53 by tomcat website. I tested in terminal running ./startup.sh (from tomcat 8.0.53 /bin directory and our other config) and ok running. At /etc/tomcat/tomcat.conf I put the path about:

    Code:
    #Where your java installation lives
    JAVA_HOME="/usr/libi64/jvm/jre-11"
    Code:
    # Where your tomcat installation lives
    CATALINA_HOME="/usr/share/tomcat" (path from tomcat 8.0.53)
    and ok,
    Go to Yast - services manager - tomcat - start boot - on boot - Save -
    In OPENSUE 42.2 it runs tomcat version 8.0.53 ok, nice and from boot


    So, I did try the same config in Opensuse 15.0. In opensuse 15.0 in packages it installs tomcat 9. After put the paths at /etc/tomcat/tomcat.conf from tomcat 8.0.53
    run the command:

    systemctl tomcat start
    systemctl tomcat status

    and show me:

    Nov 29 09:28:48 equiplanov server[14069]: See the Home Screen API documentation for more information�>
    Nov 29 09:28:48 equiplanov server[14069]: @argument files
    Nov 29 09:28:48 equiplanov server[14069]: One or more argument files containing options
    Nov 29 09:28:48 equiplanov server[14069]: -disable-@files
    Nov 29 09:28:48 equiplanov server[14069]: Prevents further expansion of argument file
    Nov 29 09:28:48 equiplanov server[14069]: nTo specify an argument for a long option, you can use - <name> = <value> or
    Nov 29 09:28:48 equiplanov server[14069]: --<name> <value>.
    Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Main process exited, code=exited, status=1/FAILURE
    Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Unit entered failed state.
    Nov 29 09:28:48 equiplanov systemd[1]: tomcat.service: Failed with result 'exit-code'.

    So, please any Idea how to solve this

    I can not install tomcat 9, for that app needs to be tomcat 8.0.53 version!


    Thanks attention and help

    Douglas[/QUOTE]

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,477
    Blog Entries
    2

    Default Re: how to run tomcat 8.0.53 unit systemd file opensuse 15.0

    Hi,
    I think you misunderstood the instructions embedded in the original tomcat Unit file which suggested "if you want to clone the tomcat service" to create a new tomcat@.service Unit file...

    I don't know exactly how whoever wrote that comment chose those words, but AFAIK typically that described procedure creates spawned child instances of that one defined service. In a way that might suggest "cloning" is creating additional instances but I don't know that's a clear concept to a reader.

    But,
    I don't think you were actually trying to create multiple instances of tomcat running side by side...
    I think you were simply trying to create a customized single instance of tomcat...

    If that is the case, then all you had to do was copy the Unit file to the location reserved for User customized versions of default Unit files, and then modify as desired
    Code:
    cp /usr/lib/systemd/system/tomcat.service /etc/systemd/system/tomcat.service
    After the above,
    You can make all the modifications you described in your successful effort, pointing to files, setting environmental values or anything else you please and your copy of the Unit file over-rides the default instance.
    When/if you want to remove your personal, customized configuration, all you need to delete your copy and the default file will resume as the active configuration.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •