You are not logged in.

#1 2014-09-14 22:57:49

ZMoore
Member
Registered: 2012-03-30
Posts: 16

Jenkins not deploying on Tomcat; SSH Service not starting

So I've had a couple of problems happening. My first problem is that even though sshd.service and sshd.socket are enabled with systemctl, it does not automatically start. There are no errors reported in journalctl, it just does not start. When issuing systemctl status sshd.service and systemctl status sshd.socket, there is nothing to report. Once I manually start them, there are no errors reported, and everything works as expected.

sshd.socket

[Unit]
Conflicts=sshd.service
Wants=sshdgenkeys.service

[Socket]
ListenStream=22
Accept=yes

[Install]
WantedBy=sockets.target

sshd.service

[Unit]
Description=OpenSSH Daemon
Wants=sshdgenkeys.service
After=sshdgenkeys.service
After=network.target

[Service]
ExecStart=/usr/bin/sshd -D
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always

[Install]
WantedBy=multi-user.target

# This service file runs an SSH daemon that forks for each incoming connection.
# If you prefer to spawn on-demand daemons, use sshd.socket and sshd@.service.

The second problem is my tomcat service. It won't start the Jenkins. I've linked the jenkins.war file to the webapps folder. When I start tomcat using systemctl start tomcat8, this is the output of journalctl -xn

-- Logs begin at Sat 2014-08-30 06:46:59 PDT, end at Sun 2014-09-14 15:45:38 PDT. --
Sep 14 15:45:15 localhost jsvc.exec[1344]: Sep 14, 2014 3:45:15 PM org.apache.coyote.AbstractProtocol stop
                                           INFO: Stopping ProtocolHandler ["http-nio-8080"]
Sep 14 15:45:16 localhost jsvc.exec[1344]: Sep 14, 2014 3:45:16 PM org.apache.coyote.AbstractProtocol stop
                                           INFO: Stopping ProtocolHandler ["ajp-nio-8009"]
Sep 14 15:45:16 localhost jsvc.exec[1344]: Sep 14, 2014 3:45:16 PM org.apache.coyote.AbstractProtocol destroy
                                           INFO: Destroying ProtocolHandler ["http-nio-8080"]
Sep 14 15:45:16 localhost jsvc.exec[1344]: Sep 14, 2014 3:45:16 PM org.apache.coyote.AbstractProtocol destroy
                                           INFO: Destroying ProtocolHandler ["ajp-nio-8009"]
Sep 14 15:45:27 localhost systemd[1]: [/usr/lib/systemd/system/systemd-journal-upload.service:20] Unknown lvalue 'After' in section 'Install'
Sep 14 15:45:38 localhost systemd[1]: Failed to reset devices.list on /system.slice: Invalid argument
Sep 14 15:45:38 localhost jsvc[28476]: Cannot locate Java Home
Sep 14 15:45:38 localhost systemd[1]: tomcat8.service: control process exited, code=exited status=1
Sep 14 15:45:38 localhost systemd[1]: Failed to start Tomcat 8 servlet container.
-- Subject: Unit tomcat8.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit tomcat8.service has failed.
-- 
-- The result is failed.
Sep 14 15:45:38 localhost systemd[1]: Unit tomcat8.service entered failed state.

Here is the tomcat8.service file before my changes, as suggested here

[Unit]
Description=Tomcat 8 servlet container
After=network.target

[Service]
Type=forking
PIDFile=/var/run/tomcat8.pid
Environment=CATALINA_PID=/var/run/tomcat8.pid
Environment=TOMCAT_JAVA_HOME=/usr/lib/jvm/java-7-openjdk
Environment=CATALINA_HOME=/usr/share/tomcat8
Environment=CATALINA_BASE=/usr/share/tomcat8
Environment=CATALINA_OPTS=

ExecStart=/usr/bin/jsvc \
            -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 \
            -user tomcat8 \
            -java-home ${TOMCAT_JAVA_HOME} \
            -pidfile /var/run/tomcat8.pid \
            -errfile SYSLOG \
            -outfile SYSLOG \
            $CATALINA_OPTS \
            org.apache.catalina.startup.Bootstrap

ExecStop=/usr/bin/jsvc \
            -pidfile /var/run/tomcat8.pid \
            -stop \
            org.apache.catalina.startup.Bootstrap

[Install]
WantedBy=multi-user.target

And after

[Unit]
Description=Tomcat 8 servlet container
After=network.target

[Service]
Type=forking
PIDFile=/var/run/tomcat8.pid
Environment=CATALINA_PID=/var/run/tomcat8.pid
Environment=TOMCAT_JAVA_HOME=/usr/lib/jvm/java-7-openjdk
Environment=CATALINA_HOME=/usr/share/tomcat8
Environment=CATALINA_BASE=/usr/share/tomcat8
Environment=CATALINA_OPTS=-DJENKINS_HOME=/usr/share/java/jenkins

ExecStart=/usr/bin/jsvc \
            -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 \
            -user tomcat8 \
            -java-home ${TOMCAT_JAVA_HOME} \
            -pidfile /var/run/tomcat8.pid \
            -errfile SYSLOG \
            -outfile SYSLOG \
            $CATALINA_OPTS \
            org.apache.catalina.startup.Bootstrap

ExecStop=/usr/bin/jsvc \
            -pidfile /var/run/tomcat8.pid \
            -stop \
            org.apache.catalina.startup.Bootstrap

[Install]
WantedBy=multi-user.target

EDIT:
The SSHD problem is fixed. I read more closely at the sshd.socket config, and it clearly states it conflicts with sshd.service. I disabled service and everything works fine. But I am still having trouble getting Jenkins to work with Tomcat.

Last edited by ZMoore (2014-09-15 00:33:18)

Offline

Board footer

Powered by FluxBB