title: One or more listeners failed to start - tomcat8
body: <p>i am trying to deploy my war file to tomcat 8..</p>
  
  <p>i get this error..</p>
  
  <pre><code>Configuring Spring Security Core ...
  ... finished configuring Spring Security Core
  
  27-Nov-2015 12:05:30.872 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
  27-Nov-2015 12:05:30.899 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
  27-Nov-2015 12:05:31.950 SEVERE [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [org.grails.web.converters.configuration.ConvertersConfigurationHolder$2] (value [org.grails.web.converters.configuration.ConvertersConfigurationHolder$2@3452ee75]) and a value of type [java.util.HashMap] (value [{}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
  27-Nov-2015 12:05:31.955 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /root/apache-tomcat-8.0.28/webapps/ROOT.war has finished in 95,296 ms
  27-Nov-2015 12:05:31.958 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
  27-Nov-2015 12:05:31.964 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
  27-Nov-2015 12:05:31.968 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 95506 ms
  </code></pre>
  
  <p>i am using java 1.7.0_75, tomcat 8.0.28</p>
  
  <p>this is my setenv.sh</p>
  
  <pre><code>CATALINA_OPTS="-server -d64 -Xms512m -Xmx512m -XX:PermSize=1024m -XX:MaxPermSize=1024m -XX:-UseGCOverheadLimit -XX:-PrintGCDetails -Djava.awt.headless=true -Dfile.encoding=UTF-8"
  export CATALINA_OPTS
  </code></pre>
  
  <p>anyone know why i get this error?</p>
  
  <p>i build a war with grails 3.0.9</p>
  
  <p>================================================================</p>
  
  <p>when i start tomcat.. i just get this log in /logs/catalina.out</p>
  
  <pre><code>27-Nov-2015 12:03:55.984 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.28
  27-Nov-2015 12:03:55.994 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Oct 7 2015 18:25:21 UTC
  27-Nov-2015 12:03:55.994 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.28.0
  27-Nov-2015 12:03:55.994 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
  27-Nov-2015 12:03:55.995 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.7.2-042stab092.2
  27-Nov-2015 12:03:55.995 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
  27-Nov-2015 12:03:55.995 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.7.0_79/jre
  27-Nov-2015 12:03:55.996 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_79-b15
  27-Nov-2015 12:03:55.996 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
  27-Nov-2015 12:03:55.996 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /root/apache-tomcat-8.0.28
  27-Nov-2015 12:03:55.996 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /root/apache-tomcat-8.0.28
  27-Nov-2015 12:03:55.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/root/apache-tomcat-8.0.28/conf/logging.properties
  27-Nov-2015 12:03:55.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
  27-Nov-2015 12:03:55.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms1024m
  27-Nov-2015 12:03:55.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1024m
  27-Nov-2015 12:03:55.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:PermSize=1024m
  27-Nov-2015 12:03:55.999 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024m
  27-Nov-2015 12:03:55.999 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms780m
  27-Nov-2015 12:03:56.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx780m
  27-Nov-2015 12:03:56.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:PermSize=1024m
  27-Nov-2015 12:03:56.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024m
  27-Nov-2015 12:03:56.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:-UseGCOverheadLimit
  27-Nov-2015 12:03:56.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:-PrintGCDetails
  27-Nov-2015 12:03:56.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
  27-Nov-2015 12:03:56.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=UTF-8
  27-Nov-2015 12:03:56.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/root/apache-tomcat-8.0.28/endorsed
  27-Nov-2015 12:03:56.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/root/apache-tomcat-8.0.28
  27-Nov-2015 12:03:56.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/root/apache-tomcat-8.0.28
  27-Nov-2015 12:03:56.006 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/root/apache-tomcat-8.0.28/temp
  27-Nov-2015 12:03:56.006 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
  27-Nov-2015 12:03:56.372 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]
  27-Nov-2015 12:03:56.438 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
  27-Nov-2015 12:03:56.452 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
  27-Nov-2015 12:03:56.455 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
  27-Nov-2015 12:03:56.461 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1767 ms
  27-Nov-2015 12:03:56.550 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
  27-Nov-2015 12:03:56.550 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.28
  27-Nov-2015 12:03:56.659 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /root/apache-tomcat-8.0.28/webapps/ROOT.war
  27-Nov-2015 12:04:07.850 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.
  
  Configuring Spring Security Core ...
  ... finished configuring Spring Security Core
  
  anc
  Environment.current = PRODUCTION
  Environment.DEVELOPMENT = DEVELOPMENT
  Environment.current = PRODUCTION
  Environment.DEVELOPMENT = DEVELOPMENT
  27-Nov-2015 12:05:30.872 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
  27-Nov-2015 12:05:30.899 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
  27-Nov-2015 12:05:31.950 SEVERE [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [org.grails.web.converters.configuration.ConvertersConfigurationHolder$2] (value [org.grails.web.converters.configuration.ConvertersConfigurationHolder$2@3452ee75]) and a value of type [java.util.HashMap] (value [{}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
  27-Nov-2015 12:05:31.955 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /root/apache-tomcat-8.0.28/webapps/ROOT.war has finished in 95,296 ms
  27-Nov-2015 12:05:31.958 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
  27-Nov-2015 12:05:31.964 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
  27-Nov-2015 12:05:31.968 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 95506 ms
  </code></pre>
  
  <p>after i check...tomcat 8  was failed to run this code</p>
  
  <pre><code>public void contextInitialized(ServletContextEvent event) {
          ServletContext servletContext = event.servletContext
          final ServerContainer serverContainer = servletContext.getAttribute("javax.websocket.server.ServerContainer")
          try {
  
              println "Environment.current = "+Environment.current
              if (Environment.current == Environment.PRODUCTION) {
                  serverContainer.addEndpoint(ServerEndPointDemo) //&lt;&lt;&lt;&lt; this code
                  println "run 123"
              }
              println "--- we have a connection"
              int defaultMaxSessionIdleTimeout = 900000 //config.timeout ?: 0
              serverContainer.defaultMaxSessionIdleTimeout = defaultMaxSessionIdleTimeout
          }
          catch (IOException e) {
              log.error e.message, e
              println "e = "+e
          }
      }
  </code></pre>
  
  <p><strong>serverContainer.addEndpoint(ServerEndPointDemo)</strong> this code was the problem</p>