Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#817909: Restarting tomcat7 on Debian 8 does not always stop current running process, resulting in the service entering a failed state

11 views
Skip to first unread message

Emlyn Kinzett

unread,
Mar 11, 2016, 8:20:04 AM3/11/16
to
Package: tomcat7
Version: 7.0.56

When I run '/etc/init.d/tomcat7 restart’ from a normal shell, I receive the following error in syslog:

tomcat7[24432]: Starting Tomcat servlet engine: tomcat7 failed!
systemd[1]: tomcat7.service: control process exited, code=exited status=1
systemd[1]: Failed to start LSB: Start Tomcat..
systemd[1]: Unit tomcat7.service entered failed state.
Process: 24432 ExecStart=/etc/init.d/tomcat7 start (code=exited, status=1/FAILURE)

The following was logged in catalina.out:

Mar 09, 2016 6:40:12 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Mar 09, 2016 6:40:12 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Mar 09, 2016 6:40:12 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Mar 09, 2016 6:40:12 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Mar 09, 2016 6:40:12 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Mar 09, 2016 6:40:12 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Mar 09, 2016 6:40:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 09, 2016 6:40:12 PM org.apache.coyote.AbstractProtocol init
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use <null>:8080
        at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:411)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:646)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
        at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:821)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
Caused by: java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
        at java.net.ServerSocket.bind(ServerSocket.java:376)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at java.net.ServerSocket.<init>(ServerSocket.java:181)
        at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
        at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:398)
        ... 17 more

It looks as though when the restart command is invoked, the current process is not stopped correctly and therefore a new process cannot be started (this line: java.net.BindException: Address already in use <null>:8080). tomcat7 was already listening on port 8080 because it wasn’t stopped, so couldn’t be started.

Kernel in use is: Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29) x86_64 GNU/Linux

I’m using libc6 2.19-18+deb8u3 

Java version:
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-1~deb8u1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

The /etc/tomcat7/server.xml file is completely standard. /etc/default/tomcat7 has been edited to simply allocate more memory:
JAVA_OPTS="-Djava.awt.headless=true -Xms1024m -Xmx1024m -XX:+UseConcMarkSweepGC”

signature.asc

Emmanuel Bourg

unread,
Aug 9, 2018, 5:50:03 AM8/9/18
to
Control: forcemerge 832151 -1

Le 11/03/2016 à 14:08, Emlyn Kinzett a écrit :

> It looks as though when the restart command is invoked, the current
> process is not stopped correctly and therefore a new process cannot be
> started (this line: java.net.BindException: Address already in use
> <null>:8080). tomcat7 was already listening on port 8080 because it
> wasn’t stopped, so couldn’t be started.

I've run into similar issues too, systemd didn't track properly the
state of the Tomcat instance spawned by the init.d script. I think this
issue will go away once we provide a proper systemd service file for
Tomcat. I'm currently experimenting with this and it works rather well.

Emmanuel Bourg
0 new messages