You are not logged in.

#1 2018-07-03 08:20:53

danSman
Member
Registered: 2017-12-21
Posts: 47

[SOLVED]Tomcat8 - Start problems

Hi

I followed the wiki. So, I add/changed following options:

server.xml
I have to change the port="8080" to "4443".

tomcat-users.xml
I added   
  <role rolename="tomcat"/>
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
  <role rolename="admin-gui"/>
  <role rolename="admin-script"/>
  <user username="tomcat" password="123" roles="tomcat"/>
  <user username="manager" password="123" roles="manager-gui,manager-script,manager-jmx,manager-status"/>
  <user username="admin" password="123" roles="admin-gui"/>

before

</tomcat-users>

Following problems are:

Cannot find any VM in Java Home /usr/lib/jvm/default-runtime
systemd[1]: tomcat8.service: Can't open PID file /var/run/tomcat8.pid (yet?) after start: No such file or directory
systemd[1]: tomcat8.service: Supervising process 843 which is not our child. We'll most likely not notice when it exits.
systemd[1]: Started Tomcat 8 servlet container.
myServer jsvc.exec[842]: 2018-07-03 20:10:29 843 jsvc.exec error: Cannot find any VM in Java Home /usr/lib/jvm/default-runtime
                                         2018-07-03 20:10:29 843 jsvc.exec error: Cannot locate JVM library file
archlinux-java status
Available Java environments:
  java-10-openjdk (default)
java -version
openjdk version "10.0.1" 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10)
OpenJDK Server VM (build 10.0.1+10, mixed mode)
ls -la /usr/lib/jvm/
default -> java-10-openjdk
default-runtime -> java-10-openjdk
java-10-openjdk

Thanks

Last edited by danSman (2018-07-04 22:09:17)

Offline

#2 2018-07-03 08:28:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]Tomcat8 - Start problems

PLease use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Co … s_and_code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2018-07-03 09:03:19

danSman
Member
Registered: 2017-12-21
Posts: 47

Re: [SOLVED]Tomcat8 - Start problems

Done. Sry.

Offline

#4 2018-07-03 13:03:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,082

Re: [SOLVED]Tomcat8 - Start problems

Can you reproduce with java 8 ? java 9 and 10 added some invasive changes that need active adaptation by many projects. And our tomcat package is comparatively old and likely hasn't added relevant necessary adaptations yet.

Last edited by V1del (2018-07-03 13:14:56)

Offline

#5 2018-07-04 22:08:49

danSman
Member
Registered: 2017-12-21
Posts: 47

Re: [SOLVED]Tomcat8 - Start problems

Thanks for the hint.

Tomcat7 & 8 are working with jave 8.

Offline

#6 2019-06-10 19:58:22

matoro
Member
Registered: 2016-08-31
Posts: 6

Re: [SOLVED]Tomcat8 - Start problems

Hope this necrobump is in order as I encountered this problem with Java 11.  A short discussion with the kind folks in the #tomcat channel was able to identify the issue.  It comes from Arch's use of jsvc (see "Start/stop Tomcat" in https://wiki.archlinux.org/index.php/Tomcat ) to allow binding to privileged ports and accessing root-readable files.  Normally jsvc is advantageous security-wise, but it is the Apache Commons daemon that is incompatible with newer Java versions, not Tomcat.

The advantage to using jsvc is that Tomcat does not need to run as root, but can still access root-only features at startup.  To take advantage of this, the Arch package makes the /usr/share/tomcat8/bin directory, which contains the JAR files, accessible only to root.  Now, you have two options:  either have Tomcat run as root, or chmod the permissions on these files.  Either way, add the following to your override (systemctl edit) for tomcat8.service:

[Service]
Type=simple
User=tomcat8
Group=tomcat8
Environment=JAVA_HOME=${TOMCAT_JAVA_HOME}

ExecStart=
ExecStart=/usr/lib/jvm/default-runtime/bin/java \
            -Dcatalina.home=${CATALINA_HOME} \
            -Dcatalina.base=${CATALINA_BASE} \
            -Djava.io.tmpdir=/var/tmp/tomcat8/temp \
            -cp /usr/share/java/commons-daemon.jar:/usr/share/java/eclipse-ecj.jar:${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar \
            $CATALINA_OPTS \
            org.apache.catalina.startup.Bootstrap

ExecStop=
ExecStop=/usr/lib/jvm/default-runtime/bin/java \
            -cp /usr/share/java/commons-daemon.jar:/usr/share/java/eclipse-ecj.jar:${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar \
            stop org.apache.catalina.startup.Bootstrap

If you prefer Tomcat to run as root, simply disable the User= and Group= lines.  Otherwise, you must additionally make

/usr/share/tomcat8/bin/{bootstrap,tomcat-juli}.jar

readable to the tomcat8 user, how you do that is up to you (world-readable, chown to add tomcat8 group, etc).  Using this I was able to successfully run Tomcat 8 under Java 11.

Offline

Board footer

Powered by FluxBB