Background - I am refactoring some legacy code into the spring web-mvc framework.
I am using Spring 5.0.5.RELEASE and tomcat 8.5.31.
I am launching the application through eclipse Oxygen.3a Release (4.7.3a) and on Fedora 28.
Problem - When starting up tomcat, the application dispatcher intermittently (about 75% of the time) re-launches. It seems that after the application loads, and I get a finished message, and reloads.
After completing the second application loading, everything seems to work normally.
In production, since I have a few timer tasks that get created at startup, these tend to get duplicated. Thus I have duplicate timer task threads running, which is a problem.
—————————————FIRST LAUNCH EXAMPLE
05-Jul-2018 20:45:29.207 INFO [Thread-17] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
05-Jul-2018 20:45:29.209 INFO [Thread-17] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
05-Jul-2018 20:45:29.211 INFO [Thread-17] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
05-Jul-2018 20:45:29.212 INFO [Thread-17] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
05-Jul-2018 20:45:29.931 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.31
05-Jul-2018 20:45:29.933 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Apr 27 2018 20:24:25 UTC
05-Jul-2018 20:45:29.934 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.31.0
05-Jul-2018 20:45:29.934 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
05-Jul-2018 20:45:29.934 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.16.15-300.fc28.x86_64
05-Jul-2018 20:45:29.934 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
05-Jul-2018 20:45:29.934 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-4.b10.fc28.x86_64/jre
05-Jul-2018 20:45:29.935 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_171-b10
05-Jul-2018 20:45:29.935 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
05-Jul-2018 20:45:29.936 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /opt/apache-tomcat-8.5.31
05-Jul-2018 20:45:29.936 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/apache-tomcat-8.5.31
05-Jul-2018 20:45:29.936 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
05-Jul-2018 20:45:29.937 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
05-Jul-2018 20:45:29.937 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
05-Jul-2018 20:45:29.938 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom
05-Jul-2018 20:45:29.938 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
05-Jul-2018 20:45:29.939 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
05-Jul-2018 20:45:29.939 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
05-Jul-2018 20:45:29.939 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512M
05-Jul-2018 20:45:29.939 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx2048M
05-Jul-2018 20:45:29.940 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseParallelGC
05-Jul-2018 20:45:29.940 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
05-Jul-2018 20:45:29.941 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
05-Jul-2018 20:45:29.941 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
05-Jul-2018 20:45:29.941 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
05-Jul-2018 20:45:29.941 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
05-Jul-2018 20:45:30.042 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
05-Jul-2018 20:45:30.053 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Jul-2018 20:45:30.061 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
05-Jul-2018 20:45:30.063 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Jul-2018 20:45:30.064 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 592 ms
05-Jul-2018 20:45:30.088 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
05-Jul-2018 20:45:30.088 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.31
05-Jul-2018 20:45:32.224 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2018-07-05 20:45:32 INFO o.s.w.s.DispatcherServlet:494 - FrameworkServlet 'dispatcher': initialization started
2018-07-05 20:45:32 INFO o.s.w.c.s.XmlWebApplicationContext:590 - Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Thu Jul 05 20:45:32 UTC 2018]; root of context hierarchy
2018-07-05 20:45:32 INFO o.s.b.f.x.XmlBeanDefinitionReader:316 - Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
(There is more here but just wanted to show to the TLD and dispatcher initialization......)
———————SECOND LAUNCH EXAMPLE
(The first launch finishes with the spring URL mapping messages...)
2018-07-05 20:28:34 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping:547 - Mapped "{[/manualArtifact],methods=[GET]}" onto public java.lang.String com.deorc.controller.ViewManualController.manualArtifact(javax.servlet.http.HttpServletRequest,org.springframework.ui.Model)
2018-07-05 20:28:34 INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping:547 - Mapped "{[/manualBonuses],methods=[GET]}" onto public java.lang.String com.deorc.controller.ViewManualController.manualBonuses(javax.servlet.http.HttpServletRequest,org.springframework.ui.Model)
2018-07-05 20:28:35 INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter:574 - Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Thu Jul 05 20:28:27 UTC 2018]; root of context hierarchy
2018-07-05 20:28:35 INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter:574 - Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Thu Jul 05 20:28:27 UTC 2018]; root of context hierarchy
2018-07-05 20:28:35 INFO o.s.w.s.h.SimpleUrlHandlerMapping:373 - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
2018-07-05 20:28:35 INFO o.s.w.s.DispatcherServlet:509 - FrameworkServlet 'dispatcher': initialization completed in 7348 ms
05-Jul-2018 20:28:37.167 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2018-07-05 20:28:37 INFO o.s.w.s.DispatcherServlet:494 - FrameworkServlet 'dispatcher': initialization started
2018-07-05 20:28:37 INFO o.s.w.c.s.XmlWebApplicationContext:590 - Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Thu Jul 05 20:28:37 UTC 2018]; root of context hierarchy
2018-07-05 20:28:37 INFO o.s.b.f.x.XmlBeanDefinitionReader:316 - Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
——————————————————
NOTE: I don’t know why I am getting two controller advice info logs giving me the start up date for the ‘dispatcher-servlet’. And I am not sure if this is the issue.
The only logged item between initialization competed and started is an info message from Tomcat about the TLD scanner. This would seem to indicate the start of the second launch. The same TLD message exists prior to the first initialization. Thus, I do not think it is an issue. I tried turning off the TLD scan w/o success.
Any suggestions or recommendations would be greatly appreciated.